Dec 15, 2011

Creating Custom properties in Word 2003

In the articles Part I,Part II and Part III we have discussed about how to read the custom properties of word 2003 using  DSO dll in C# .Net.
In this article we are going to see about creating a bookmark and set the custom properties for the Microsoft Word 2003.
Steps
1. Open the Microsoft Word 2007 and create a new word document.
2. For creating the Bookmark, we need Forms option in the Microsoft Word Menu.
3.  Right click on the Menu bar and you will see forms options and check the option you will see the forms menu
4.   Then click the Textbox option (will be having a symbol ”ab”)

5.  Insert a text box and mouse click to see the properties.
6.   Now in the Bookmark option give the property name (here I gave it as CompanyName )

7. Now go to File Menu->properties-> Custom properties tab as shown below

8.  Now in the Name field give the Name (I gave as TestCompany) and check the Link to Content so that you will see the bookmark created and link the content we have created (CompanyName)
9. Now you will see the added property as below.

10. Click Add and now the properties are set. If you type a value in the document, the value must be assigned and you can see in the properties as shown below.
So, once the properties are set we can read the values using c# .Net.
Enjoy! 




Dec 14, 2011

MediaWebPart in SharePoint 2010

In this article, we will discuss how to use the out of box webpart named "Media WebPart" in SharePoint 2010.
Note : This webpart is prsent only in the SharePoint 2010 and SharePoint foundation.
Steps:
1. Go to the sharepoint where you want to add the media webpart.
2. Go to Edit Page -> Insert -> WebPart (from the ribbon) -> Categories (Media and Content) -> Select Media webpart and insert as shown below


3. Now click on Edit the webpart to configure the media.
4. Once clicked Edit you could see various options such as Media, properties, Styles, Play Styles and Size.
 
5. Go to Change Media option and there ae three options here. you link a media from the SharePoint Library or from your local computer or from any web address.

6. Here I will insert from the local computer and click save the web part, the web part is ready to use.You will see the media web part as shown below.

I gave the option as Start Media Automatically in the Media Properties so that, it starts when the page loads.

Dec 12, 2011

SlideShow with Thumbnails using Silverlight for SharePoint

I would like to share a link which shows how to create a Slide Show for SharePoint using Silverlight in Microsoft Visual Studio 2010.


Embedding YouTube Videos to the SharePoint Site

Steps
1.  Go to the YouTube site and navigate to the video which you like to embed in the SharePoint Application.
2.  Click on Share button below the video as shown below


3. On clicking Share you will find two options as Mail or Embed as shown below
 


4.  Copy the code from the Embed option as show above and save it in a notepad. I named it as youtubetest.txt
Code example in my case
<iframe width="560" height="315" src="http://www.youtube.com/embed/6986O9VA6LU" frameborder="0" allowfullscreen></iframe>
5. Upload the text file to SharePoint Document Library and right click on the file and
copy the shortcut from it.
6.  Now go to the SharePoint page where you like to add the YouTube video and edit 
the page.
7. Click insert a web part -> add a Content Editor web part 
8. Edit the web part and now add the shortcut of the youtubetest.txt path in the Content Link property of the web part or you can directly add the code which is copied from the YouTube site in the Source Editor property of the web part and save it.
You will get the following result.


You can place this web part in the Home Page of your SharePoint site.
Enjoy!

Dec 11, 2011

Reading Custom Properties of Word Document

Part III
Read the Introduction about this article Part I
Read about reading the summary properties of word document in this article Part II
In this post, we can see what is the code for the reading the custom properties of the word document.
public static void GetDocumentCustomProperties(string filename)
{
            OleDocumentPropertiesClass doc = new OleDocumentPropertiesClass();
            doc.Open(filename, true, dsoFileOpenOptions.dsoOptionOpenReadOnlyIfNoWriteAccess);
            //Reading and writing the custom properties to a file
            StreamWriter sw1= new StreamWriter(@"D:\FileRead_Custom.txt");
            CustomProperties obj_CustomProp = doc.CustomProperties;
            foreach (CustomProperty custom_prop in obj_CustomProp )
            {
                sw1.WriteLine(custom_prop.Name   "    "   custom_prop.get_Value());
            }
            sw1.Close();
            doc.Close(false);
}
Hope this helps you!

Reading Summary Properties of Word Document

Part II
Read the Introduction about this article Part I
In this post, we can see what is the code for the reading the summary properties of the word document.
public static void GetDocumentSummaryProperties(string filename)
{
            DSOFile.OleDocumentPropertiesClass doc = new DSOFile.
            OleDocumentPropertiesClass();
            doc.Open(filename, false,

            DSOFile.dsoFileOpenOptions.dsoOptionOpenReadOnlyIfNoWriteAccess );

            //getting the properties of the document
            DSOFile.SummaryProperties summaryProp = doc.SummaryProperties;

            //reading and writng the summary properties to a file
            string author = summaryProp.Author;
            string comapanyName = summaryProp.Company;
            string managerName = summaryProp.Manager;
            StreamWriter sw = new StreamWriter(@&quot;D:\FileRead.txt&quot;);
            sw.WriteLine(author);
            sw.WriteLine(comapanyName);
            sw.WriteLine(managerName);
            sw.Close();
}
That’s It. Enjoy Happy Coding!
Also, read how to Read the Custom Properties of Word Document Part III

Reading Document Properties

Part I
We are going to discuss about a interesting topic which can be used in SharePoint and also in .Net.
It is possible to reading the summary properties and custom properties of the word document and it is also one of the requirements now a days.
This can be done through using DSO dll which can be downloaded from the below link
(Important Note: This is a 32 bit dll )

What is DSO dll ?
The Dsofile.dll sample file is an in-process ActiveX component for programmers that use Microsoft Visual Basic .NET or the Microsoft .NET Framework. You can use this in your custom applications to read and to edit the OLE document properties that are associated with Microsoft Office files, such as the following: 
• Microsoft Excel workbooks
• Microsoft PowerPoint presentations
• Microsoft Word documents
• Microsoft Project projects
• Microsoft Visio drawings
• Other files that are saved in the OLE Structured Storage format
The Dsofile.dll sample file is written in Microsoft Visual C++. The Dsofile.dll sample file demonstrates how to use the OLE32 IPropertyStorage interface to access the extended properties of OLE structured storage files.
Features of this DLL
1. This dll is 32 bit and can read only Microsoft word 2003 (ie., .doc) formats only.
2. It has a OLE property reader class which can read the properties of the word document.
3. Using this dll, we can read both the Summary properties and also the Custom properties we create for the documents.
4. Also with this dll, we can set the custom properties programmatically.

Also, Read how to extract the summary properties of the word document in this article Part II.