Dec 20, 2011

Deploying Silverlight Application in SharePoint 2010

In the previous article, we have discussed about creating a simple Silverlight Application in Microsoft Visual Studio 2010.
Now, in this article we will discuss how to deploy the solution in the SharePoint 2010.
The New webpart feature added in the SharePoint 2010 and SharePoint Foundation 2010 is Silverlight which comes under Media and Content category.
The Solution of the Silverlight application produces a package with extension .XAP
Note: The .xap file is a package which consists of the solution created in the Silverlight Application
Hence, copy the XAP file in the SharePoint Document library and copy the shortcut (Link) of the file.
Now go to the page where you want to deploy the solution.
Insert the Silverlight webpart as shown below




Now, edit the webpart and in the URL property, browse for the .xap file copied from the Shared Documents or copy the shortcut URL as shown below


Now save the page and you will see the silverlight webpart created as shown below

So, when you click the Click this button in the webpart, you will see the message box “This is a simple silverlight Application”

That’s it, we have deployed the silverlight application in the sharepoint 2010. Enjoy.

Creating a Simple Silverlight Application in Microsoft Visual Studio 2010

In the previous article ,we have discussed about the basics of Silverlight and In this article, we will discuss how to create a simple silverlight application using Microsoft Visual Studio 2010.
Go to Visual Studio File ->New Project
                                           
Select Visual C# in projects -> Silverlight Application (I have used .Net Framework 4.0)
Now, you will see a pop-up window like this
This windows gives the options for the user to create a new web application within the solution so that, we can test the silverlight application created here.
Here in our project, SampleSilverlightApplication.web is the web application created and we also select the silverlight version here.
Once clicked OK, a new silverlight application will be created as shown below
You will two projects created in the solution one is to design and code the application and the other is to test the application.
MainPage.xaml contains the design part of the application and MainPage.xaml.cs is the code behind where you will write the business logic.
In the right side, you will see the ToolBox which consists of Silverlight Controls which you can use for designing the application.
Now drag and drop a Label and Button in the design part and Right Click on the control -> Properties to view the properties of the control


I have changed the properties of label and button

In the .cs file, you will see the NameSpaces for the silverlight application in specific has been added.
Now, we will write the code behind for the button event as
Private void button1_click (object sender, EventArgs e)
{
MessageBox.Show(“This is a simple silverlight Application”);
}

Now save the code and debug the application. The application will render in the web application created in the initial steps.

Important Note: Once you debug the code, you will find solution package with the extension .xap in the Client Bin folder which is present in the Web Application.

This package consists of all the functionalities which is created in the application. 
When you click on the “Click this” button you will see a MessageBox pop-up with the message showing message “This is a simple silverlight Application”





That’s it we have learned how to create a simple silverlight application using Microsoft Visual Studio 2010.
See also, how to deploy the created silverlight application SharePoint 2010 in this article.
The full code can be downloaded from here.

Dec 19, 2011

Silverlight Basic Tutorials

What is Silverlight?
Various Definitions from the internet:      
1. Microsoft Silverlight is a web application framework that integrates multimedia, computer graphics, animation and interactivity into a single runtime environment.
2. Silverlight is a new cross-browser, cross-platform implementation of the .NET Framework for building and delivering the next generation of media experiences and Rich Interactive Applications (RIA) for the web. It runs in all popular browsers, including Microsoft Internet Explorer, Mozilla Firefox, Apple Safari, and Opera. 
The plug-in required to run Silverlight is very small in size hence gets installed very quickly.
3. A web browser plug-in that provides support for rich internet applications such as animation, vector graphics and audio/video playback. Silverlight competes with companies such as Adobe Flash, Adobe Flex, Adobe AIR, Adobe Shockwave, JavaFX, and Apple QuickTime. 
4. Like Flash but made by Microsoft instead of Adobe.
5. Silverlight is the new Microsoft technology on web platform for Rich Internet Applications (RIA) launched by Microsoft in 2007

Advantages of using Silverlight Control in SharePoint
 1. Only Silverlight web part is required on the server
 2. Simply Upload to Document Library of SharePoint and new version is loaded on the next page refresh
 3. No IIS Reset is necessary
 4. Debugging can be done locally on the development machine 

Demerits of using Silverlight Control
1. Only Silverlight dlls and SharePoint Object Model dlls can be used or any dlls that is not supported by Silverlight cannot be directly used in the control
2. End users must have the ability to install the Silverlight or they should have already installed it before

Development Tools
 1. Visual Studio 2008 & Visual Studio 2010 with Silverlight SDK installed
 2. Microsoft Expression Blend

Dec 15, 2011

Creating Custom Properties in Word 2007

In the previous article, I have explained about creating custom properties in word 2003. In this article, we will see how to create custom properties in word 2007.
It is slightly different from word 2003 and involves the following steps.
1. Open the Microsoft Word 2007 and create a new word document.
2. For creating the Bookmark, we need Developer Tools option in the Microsoft Word Menu.
3. Hence, lets enable it by following the steps below
     a) Click the Microsoft Office button -> word options-> popular tab-> In the “top options for
         working with word” -> select the check box named “show Developer tab in the Ribbon”
     b) You will a see the tab like shown below
                       


4.Now we will create the bookmark.
5. Select Developer Tab option-> select the legacy control as shown below
6. Here we are going to use only text boxes which is shown in the controls as “ab” as shown above in the red mark.
7. Now, Insert the text box control (a gray shaded portion will be inserted)
8. Now click on the text box inserted or properties in the developer tab to set the properties. You will see the properties window (Text Form Field Options) will pop up as shown below.


9. You have many options in that. But we are using only Bookmark option here. We will give the bookmark name as “CompanyName” as shown below.
10. Now we have to assign and link this property by giving a name to it.
11. Click Microsoft Office Button -> Prepare ->Properties  you will see as below.
12. Click on the Advanced properties you will see the pop up window as shown below
13. Click on the custom tab and give a name to the field you are going to create
(here used  ComapanyName ) in the Name field.

14. Then click link to the content in the source. You will see a list of source available. So here we will see the “Company Name” created as shown below.
15. Clicking ADD you will see the custom properties being created in the properties as below
16. That’s it. We have created a bookmark and set it as a Custom Property in the word.

17. If the user enters a value in the bookmark, then the value will be set to the created property as shown below.



Thats it. Enjoy!

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!