Tuesday 27 September 2011

Can not find .zip files in multiple upload process in a document library in sharepoint 2007 site in windows 7

Hi,

I was asked by some users that how to upload multiple zip files into a document library since zip files were not enlisted in multiple upload method in a document library in a sharepoint 2007 site with client as Windows 7.

I had a nightmare to identify the cause but finally I managed to do this. Here are the details:

Cause:
To use the multiple upload functionality active X is required to be in the client machine. These uses some registry keys and consider the zip files as normal windows explorer folders and hence zip files do not show up in this option.

Resolution:

There are two registry keys needs to be removed :

HKEY_CLASSES_ROOT\CLSID\{E88DCCE0-B7B3-11D1-A9F0-00AA0060FA31}
HKEY_CLASSES_ROOT\CLSID\{0CD7A5C0-9F37-11CE-AE65-08002B2E1262}

Before carrying out the step above first of all registry needs to be backed up.
This can be at http://windows.microsoft.com/en-IN/windows7/Back-up-the-registry. These are very simple and clear steps.

However here also you will not be able to remove the keys since the twist is not yet over. If you try to remove the keys you will find an error.
Hence these steps needs to be followed:
1. Download PsExec at this url http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx.
2. Now unzip this file and open a command prompt by running it as administrator.
3. Now point it to the location where you have extracted the zip files.
4. Now execute this command psexec -i -d -s C:\Windows\Regedit.exe
5. Now this will open the regedit navigate to the keys.
6.First step now will be to take the ownership. After selecting the key go to its child keys first and then right click on it and select permissions.
7. For System account allow full control. Now you can delete this key.
8. Do the above step for all child keys.
9. After deleting all child keys now right click on the actual key and select Permissions--> Ownership and grant ownership to the System account. Allow full control to it and thats it you will be able to delete it.
10. Do the same for both the keys and restart your computer.

This will now work for you.
I hope this will help you out.

Thanks,
Rahul Rashu


Friday 23 September 2011

How to export/Import a site programmatically in sharepoint 2007

Hi,

I received a request from site admins that they do not want to use STSADM commands to export/import a site since they do it frequently for many sites. They also wanted to do it in a single shot without running the command again for import after export. Hence I created the following console application that solves this issue. Here is the code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Deployment;

namespace SiteExportImport
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Please input the source site URL ");
            //Enter URL of your source site
            String sourceSite = Console.ReadLine();
            Console.WriteLine("Please input the destination site URL");
             //Enter URL of your destination site           
            String destinationSite = Console.ReadLine();
            Console.WriteLine("Please input the destination file location");
             //Enter the location where you want your exported files to be generated
            String fileLocation = Console.ReadLine();
            Console.WriteLine("Please input the Base file name");
            //Enter the name of your exported file
            String baseFileName = Console.ReadLine();
            Console.WriteLine("Please input the export log file location");
            //Enter full path including the name of your export log file
            String exportlogLocation = Console.ReadLine();
            Console.WriteLine("Please input the import log file location");
           //Enter full path including the name of your import log file         
            String importlogLocation = Console.ReadLine();
            SPImport import = new SPImport();
            SPExport export = new SPExport();
            SPExportSettings exportSettings = export.Settings;
            exportSettings.SiteUrl = sourceSite;
            exportSettings.CommandLineVerbose = true;
            exportSettings.ExportMethod = SPExportMethodType.ExportAll;
            exportSettings.FileLocation = fileLocation;
            exportSettings.BaseFileName = baseFileName;
            exportSettings.LogFilePath = exportlogLocation;
            exportSettings.OverwriteExistingDataFile = true;
            export.Run();
            Console.WriteLine("Export Completed");
         
            SPImportSettings importSettings = import.Settings;
            importSettings.BaseFileName = baseFileName;
            importSettings.CommandLineVerbose = true;
            importSettings.FileLocation = fileLocation;
           importSettings.LogFilePath = importlogLocation;
            importSettings.SiteUrl = destinationSite;
           import.Run();
           Console.WriteLine("Import Completed");
           Console.ReadLine();
          
        }
    }
}

The first requirement for this is to import the dll Microsoft.Sharepoint it is available in the folder ISAPI in 12 hive folder. The input values along with their significance is given as comments.
This can be modified further as per the needs. This can be executed from ant WFE in a farm.

I hope this will help you out.

Thanks,
Rahul Rashu


Thursday 15 September 2011

Can not change master page of a wiki site in sharepoint 2007

HI ,

Recently someone requested me to change the default master page of a wiki site to something else.
I designed a master page and uploaded that in master page gallery.

However when I went to site settings page there was no option of "Master Page" under look and feel.
So I tried usual way of directly going by URL and pasted this in URL _layouts/ChangeSitemasterpage.aspx,
I got an error on my screen as:
Invalid field name. {7581e709-5d87-42e7-9fe6-698ef5e86dd3}   at Microsoft.SharePoint.SPFieldCollection.GetFieldById(Guid fieldId, Boolean bThrowException)
   at Microsoft.SharePoint.SPFieldCollection.get_Item(Guid id)
   at Microsoft.SharePoint.Publishing.Internal.QueryBuilderHelper.AddExcludeObsoleteToQuery(StringBuilder builder, SPDocumentLibrary layoutLibrary)
   at Microsoft.SharePoint.Publishing.PublishingSite.GetMasterPageLayouts(Boolean excludeObsolete)
   at Microsoft.SharePoint.Publishing.Internal.CodeBehind.AreaChromeSettingsPage.InitDataList()
   at Microsoft.SharePoint.Publishing.Internal.CodeBehind.AreaChromeSettingsPage.LoadValues()
   at Microsoft.SharePoint.Publishing.Internal.CodeBehind.AreaChromeSettingsPage.OnLoad(EventArgs e)
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)



I got the documentation about this error in a KB article http://support.microsoft.com/kb/2000827 .
I followed the steps but got stuck in a step where it was asking me to create a custom content type and to extend from Publishing content type since this option was not listed over there in drop down of parent content type.

I found a very simple solution to this problem. I checked in my 12/Templates/Features folder and found that these content types are getting added by a hidden site collection feature "PublishingResources".

I activated the same on the site using STSADM activate feature command http://technet.microsoft.com/en-us/library/cc262141(office.12).aspx.

So now the desired parent content type was added and I was able to locate this in the drop down.

I followed rest of the steps in the KB article and it worked for me.

I hope this will help you out




Thursday 8 September 2011

User image not displaying in a sharepoint 2007 site

Hi,
Few days back an issue was reported to me that in a sharepoint site under all people page for some of the users the image was not being shown up although they have uploaded the same.
It was coming like this:






I checked all synchronization jobs, removed the user from site collection and added again but no progress was there. I finally started comparing this with another user whose picture was coming properly. I compared a profile properties but there was no improvement. I checked permissions and  all things I could have checked but no improvement. Finally I could not believe that this was just a folder issue.

I saw that the image of the second person was uploaded in a folder named as profile pictures under shared picture library of his mysite. However when I compared the same for the first user I found that it was uploaded directly into the shared picture library. Hence I created a folder there with the name profile pictures and uploaded the image over there and the issue got resolved. The image started showing correctly in all people page.

I hope this will help you out.

Thanks,
Rahul Rashu

Saturday 3 September 2011

Using Video files in Sharepoint 2007 sites


Hi,

I have often seen people trying to use audio or video files in sharepoint sites.
In this article I am providing some very easy methods of doing it so that it will help others.
I will show two ways to use videos from youtube and from your document library.
Here we proceed:
1.       To use any youtube video open the youtube video in a browser. You will get an option to share as shown

2. Now once you click on this share you will get another option panel there you select Embed. It will now look like this:

In this screen the main part of your use is the code shown in the panel. You can customize it based on your needs. You can see that the width and height is specified , however you can change it to your values by entering these values in the textboxes shown at the end. In another way you can select some standard size as well. By selecting these code shown will change accordingly. You have checkboxes available as well to use the video as per your need and with every selection the code will keep on changing. Now we are ready to use it in a or site.
3. Go to your sharepoint 2007 site and then on the page where you want to show this video.
4. Edit your page and add a content editor webpart. Edit this webpart and then add this code in source editor.
That’s all your page is ready with this video. It will look something like this


Now it is the time to use your videos, stored in your document libraries.
Follow these steps:
1. First of all upload the file in your document library. Once uploaded right click on it and select copy link as shown below.


2. Now open the page where you want to display this video. Edit this page and add a content editor webpart.
Add this script in text editor:
<div align="center">
<embed src="YourUrlHere" autoplay="true" width="250" height="200" loop="false">
</embed>
</div>
You just need to replace the YourUrlHere.
All values are self explanatory except loop. If you mark it as true it will keep on playing one after one.

I hope this will help you out.
Thanks,
Rahul Rashu