Dec 27, 2011

How to create a Tab using the labels in the blogger

In the previous article, we have discussed about increasing the traffic or the number of users to the blog. In this article, we will discuss how to create a tab using the labels which you have created for the posts in your blog.

If you have the older version of the blog, then in the design mode you will see an option for “Try the Updated Blogger Interface” and click to update to the new interface as shown below.

Don’t worry, at any time you can switch back to the older interface.
After updating to the new interface, go to the design and you will see a right navigation bar. In that, select Pages as shown below.
Once you click Pages, you will get a popup window allows you to create a blank page and the other is web address as shown below.
We will select web Address, as we are going to create a tab using the existing label URL.
When you click the Web address (as shown in the above figure), you will re-direct to popup window, where you can enter the Tab title and the Label URL.
Now, save the Web Address.
That’s it. Now, we will see a tab with the particular label which will show all the posts in the label.
Happy Blogging! 

Dec 26, 2011

How to hide the download a copy option (Context Menu) in the Document Library

In the document library we have an option of downloading the document as shown below.

If the user wants to hides or remove this option for all the users. The following steps will explain the same.
1. First locate the following path C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\1033
2. Find the file named “CORE.js”. This is the file which will run the scripts downloading option for the document library.
3. Open the core.js file in best .js file editor and search for the function 
        AddSendSubMenu(m,ctx)
        Where you can see
        menuOption=CAMOpt(sm, L_DownloadACopy_Text, strAction, "");
        menuOption.id="ID_DownloadACopy";
These lines of code which will display text "Download A Copy" and call the menu operation.
So, comment the code and save the file.
4. Now when you search the context menu (Download a copy) option will be hidden as shown in the following figure.

Disadvantage
The above solution will affect all the document libraries of the SharePoint Server.
So, how to do it a particular document library or one web collection?
Hence the solution is as follows:
1. Open the default.master page in the designer.
2. Locate the core.js in the master page
<SharePoint:ScriptLink language="javascript" name="core.js"                  Defer="true" runat="server"/>
3.   So we can create our own (with the modifications as shown above) .js file (example named customcore.js) and save it in the following location
C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\1033
4.   Now we can add the reference as shown below.
<SharePoint:ScriptLink language="javascript" name="customcore.js" Defer="true" runat="server"/>
5.   Now it won’t affect all the document libraries in the SharePoint server.

Bingo. We are done. We have restricted users to download the documents from the SharePoint Document library.


How to hide the left navigation bar in the SharePoint

In this article, we will see how to hide the left navigation in SharePoint siteThere are many ways for hiding the left navigation in the SharePoint. Here is the simplest way to hide it.
1.   Master.FindControl("PlaceHolderLeftNavBar").Visible = false;
2.   Place a content editor in the page you want to hide the left navigation pane in the site and add the following code in the source editor which will hide the left navigation bar.

<style>
.ms-navframe
{
display:none;
}
</style>
That’s it. We have easily hide the left navigation bar with a simple code.

How to increase the Traffic or the Users to a Blog

Hi All,
We will start discussing about the blogger tips also.
In this article, we are going to discuss how to increase the traffic to your blog. I have listed it below.
1. Design the UI properly – Branding
     The Look and feel is very important for a blog. This is the first thing which attracts the users to visit your blog often. So, plan the design and use proper templates or themes which suites your content.
2. Provide easy navigation for the users
      The navigation is very important, which makes the readers to navigate easily
without any difficulties. The readers must able to navigate to different pages and posts with the proper navigation techniques provide by you.
3. Write well and often
      The Number of more posts in your blog will increase the number of users and also the search engines will easily crawl and navigate the users to your blog. Also, write clearly and give the content which is new and useful to the readers.
4. Add Images for clear understanding
       If your want to impress the readers and also want the readers to understand the content easily, you can give the explanations by inserting some images in between. This makes the readers to understand the situation you are explaining in the real time.
5. Submit your blog to search engines
       Initially, your blog may/may not appear in the search engine. Go to the search engine and type your blog name which allows the search engine to know that there is a blog with this name and to crawl it. Once your blog becomes popular, search engines automatically find your blog posts.
6. Adding links of the other sites
       This is one of the ways, which makes your blog popular. By adding the references to the other sites, you are allowing the user to navigate to the other sites which will increase the traffic to your blog. If you are referring for some other useful information from different sites, always create a link for that word or site which is a good way to write blog.
7. Allow reader comments and thoughts
       Allow the readers to comment and share their thoughts. This will make the blog popular. You will come to know, how the users are made helpful through your blog. You can reply to them, if they are struck up with any doubts.
8. Use links in between and trackback URL’s
       Always, create a links in between the posts. If you are writing a post, which is related to some previous posts, then you can make the readers to read the previous articles by giving a link. This makes the readers to know the other articles in your blog.
9.  Proper Titles and keywords
      This is very important for a blog which indeed increase your blog traffic in the search engines. Always, use proper title which is appropriate to the content. This will make the readers to know the theme of the article before they start reading it.
10.  Syndicate your blog’s content with RSS feed
       Sign up with the RSS feeds and allow your blog contents to burn through the feeder. Give the options like Subscribe through the RSS feeds which will allow the readers to know the new article published in your blog and in turn allows the user to visit the blog more frequently.
11.  Submit your posts to social network site
       The social networking is one of the popular media in the internet which allows the users to connect and share. Hence, submit your posts to the social networking sites.
12.  Fulfill the user’s request
        If a reader is unable to achieve the idea or solution is given by you, then you can guide them properly which will always makes the readers, a user-friendly site.
13.  Invite people to view your blog through e-mails
        If a new article is published, then you invite the readers to view the articles and hence increasing the user re-views more.
14.  Properly tag and categorize the contents
        Always, tag the articles and categorize it properly. If a reader is in need of articled of same type (tagged contents), then through the tags, they can easily navigate and read the articles.
15. Create a page or account in the social networking sites
        Create a page or account in the social networking sites and feed the posts which will allow the users from the social networking sites to view the blog.

I gave a small explanation for increasing the traffic to the blog and hope this helps in increasing the traffic to your blog.

Happy Blogging!

Dec 23, 2011

Programmatically Creating Site Backup in SharePoint

In the previous article, we have discussed about creating and restoring the SharePoint site using stsadm command.
In this article, we will see how to take the backup of the site using SharePoint Object Model.The below is the code that will create the backup of the site and log the information in a log file.
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Administration;

namespace SiteBackUp
{
    public class SiteBackup
    {
        static void Main(string[] args)
        {
         siteBackup("http://servername:portnumber","SharePointSiteBackup");   
        }
        public static void siteBackup(string siteURL,string fileName)
        {
            try 
            {
                SPSecurity.RunWithElevatedPrivileges(delegate()
                {
                    using(SPSite objSite=new SPSite(siteURL))
                    {
                        using(SPWeb objWeb=objSite.OpenWeb())
                        {
                            bool currentSiteStatus=objSite.AllowUnsafeUpdates;
                            objSite.AllowUnsafeUpdates=true;
                            bool currentWebStatus=objWeb.AllowUnsafeUpdates;
                            objWeb.AllowUnsafeUpdates=true;
                            string comment = objWeb.Title+"- Creating Backup is completed";
                            SPSiteCollection siteCollection=objSite.WebApplication.Sites;
                            objSite.ReadOnly=true;
                            string time=DateTime.Now.ToString("dd-MM-yyyy");
                            string backupName= "D:\\SiteBackup\\Backup" + fileName+"_"+time+".bak";
                            siteCollection.Backup(siteURL,backupName,false);
                            objSite.AllowUnsafeUpdates=currentSiteStatus;
                            objWeb.AllowUnsafeUpdates=currentWebStatus;
                            if(objSite.ReadOnly==true)
                            {
                               objSite.ReadOnly=false;
                               siteBackupLog(comment);
                            }                        
                         }
                    }
                });
            }
            catch (Exception ex)
            {
                SPSite site = new SPSite(siteURL);
                if (site.ReadOnly == true)
                    site.ReadOnly = false;
                siteBackupLog(ex.Message);
            }
        }
        public static void siteBackupLog(string message)
        {
            string PathName = "C:\\SiteBackup logs\\";
            PathName = PathName + "Backuplog-" + DateTime.Now.ToString("dd-MM-yyyy") + ".log";
            StreamWriter sw = new StreamWriter(PathName, true);
            sw.WriteLine(message + " - " + DateTime.Now);
            sw.Flush();
            sw.Close();
        }
    }
}

Hence, we can automate creating backup of the SharePoint site using code. Also, the whole code created in visual studio can be downloaded here.
Happy Coding!

stsadm Command for Creating Backup and Restoring a Site in SharePoint

In this article, we will discuss how to take a backup and restore it using the stsadmn command in SharePoint (WSS 3.0, MOSS 2007).
In SharePoint 2010, we use Power Shell instead of this command.
Before going for that let’s discuss about stsadm
What is stsadm command?
It is a command line tool for administration of SharePoint sites.
Where it is located in the server?

Normally, it is present in the following path

C:\ProgramFiles\Common Files\Microsoft Shared\Web Server Extensions\12\Bin

When you are in the Admin groups, you will able to use this command and perform all the functions.
Site Backup & Site Restore:
Navigate to the following path in command prompt first
C:\>cd Program Files\Common Files\Microsoft Shared\web server extensions\12\bin

1. C:\ Program Files\Common Files\Microsoft Shared\web server extensions\12\bin>stsadm.exe –o backup –url “Site URL” –filename “Location of DAT file with extension” -overwrite
2. C:\ Program Files\Common Files\Microsoft Shared\web server extensions\12\bin>stsadm.exe –o restore –url “Site URL” –filename “Location of DAT file with extension” –overwrite

Example:
Location of DAT file with extension – D:\FolderName\FileBackup.dat

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!