Jean Paul's Blog

There are 2 types of People in the World, One who Likes SharePoint and..

    Advertisements
  • Microsoft MVP

  • MindCracker MVP

  • CodeProject MVP

  • eBook on SharePoint 2010

  • eBook on Design Patterns

  • eBook on Windows Azure

  • NLayers Framework @ CodePlex

  • MSDN Forums

  • .Net vs. Java

    Due to Public Demand
  • Advertisements

Posts Tagged ‘save’

SharePoint 2010 > MS Word > New Document > Save Dialog > ‘Not Showing’ Document Library

Posted by Paul on September 26, 2013

Problems

For the past 2 years, I was seeing following problems reported by client.

  1. From SharePoint 2010 the user opened a document library & clicked on the ‘New Document’ toolbar item.  Microsoft Word was launched & while using the Save command, the original document library is not listed.  Instead a local folder being shown.
  2. From SharePoint 2010 the user opened a document in edit mode.  But while using the save command, it is prompting for save dialog, instead of saving automatically to SharePoint document library. 

Under the Hood

SharePoint rich client side features like open in Explorer, save directly to web server etc. are provided through WebDAV which represents Web Distributed Authoring and Versioning.  more

The client operating system should be running the WebClient service to enable this feature.

Solution

A typical set of solutions should be applied one-by-one to address the problem.  You can start with following.

  1. Internet Explorer Ensure you are using Internet Explorer 32-bit version.  If not start the appropriate version from start menu.
  2. Office Version Ensure you have a compatible MS Office version.  Office 2010 32 bit is best compatible with SharePoint 2010.
  3. Trusted Sites In the Internet Explorer Security Settings, ensure you have add the site url to trusted sites list.image 
  4. WebClient Open run window > services.msc & ensure WebClient service is running.  (If you are using server operating system as client, you need to install the Desktop Experience role to find WebClient service)
  5. Word Trust Center Open Microsoft Word > Options > Trust Center > Trust Center Settings.  Uncheck the 4 check boxes.image
  6. Install Patch Some client operating system requires a patch for the web folders to function properly.  You can download this from here.

Note

After each step, please restart the browser & test.

Advertisements

Posted in SharePoint, SharePoint 2010 | Tagged: , , , , , , , , , | Leave a Comment »

Saving an embedded file in C#

Posted by Paul on January 19, 2011

Suppose you are working on an application – which needs to extract another application on runtime.  How to achieve the same?

We can start with the steps below:

Step 1: Create a new Console Application

image

Step 2: Embed an exe file inside it

For this – right click on the solution explorer window and choose “Add existing item”

image

In the appearing dialog box – type c:\windows\system32\regedt32.exe

For convenience I am using the registry editor utility of windows.

(note: if your windows folder is in different drive you have to change the above path)

image

Now you can see the file added to solution explorer.

Choose the properties of file and change the Build Action property to Embedded Resource.

image

Now build your project – if successful you are ready with an exe embedded.

Step 3: Get the embedded resource name

Now our goal is to save the embedded exe in runtime to the same application folder.  For achieving this we have to first get the embedded name of the exe file.

The embedded name of the resource file would be in the format ApplicationNameSpace.ResourceName.

In our case it is: EmbedExe.regedt32.exe

You can use the method

Assembly.GetExecutingAssembly().GetManifestResourceNames()

to get all the resource names in the assembly.

Step 4: Save the embedded resource

In this final step we are retrieving the bytes of assembly and saving into a file stream.  For this we are using Stream, FileStream classes.

The code is given below:

Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(“EmbedExe.regedt32.exe”);
            FileStream fileStream = new FileStream(“new.exe”, FileMode.CreateNew);
            for (int i = 0; i < stream.Length; i++)
                fileStream.WriteByte((byte)stream.ReadByte());
            fileStream.Close();

We can see in the output folder that the new.exe is created

image

 

Posted in C# | Tagged: , , , , | 6 Comments »