March 14, 2012

After migration from MOSS 2007 to Sharepoint 2010, the month navigation wont work, the button gets disabled. This is because, the webpart is inherited from "System.Web.UI.WebControls.WebParts" Namespace, so get through this, we need to inherit our webpart in which SPCalendarview is used from "Microsoft.SharePoint.WebPartPages.WebPart" Namespace.

public class MyCalendar : Microsoft.SharePoint.WebPartPages.WebPart

Instead of

public class MyCalendar : WebPart

Copying a folder to a location as a Feature

Here, my requirement is to copy an .asmx file to IIS root folder like [C:\inetpub\wwwroot\wss\VirtualDirectories\\]....It gets copied to the location on activation and deletes the folder on deactivation.

-- Add a feature to the solution and add an event receiver to the feature with the following code below:
-----------------------------
       string strport;
        string loc = @"C:\inetpub\wwwroot\wss\VirtualDirectories\";
        public override void FeatureActivated(SPFeatureReceiverProperties properties)
        {
            ///// Code for copying (service) folder to IIS root folder.
            string strfileloc;
           SPWeb objSPWeb = (properties.Feature.Parent as SPSite).OpenWeb();
            strport = objSPWeb.Site.Port.ToString();
          
            strfileloc = loc + strport;
            bool exists = System.IO.File.Exists(strfileloc + @"\service\GetPreferredContent.asmx");
            if (!exists)
            {
                CopyFolder(@"C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\FEATURES\Wipro.MyBrand.ServiceFileCopy_ServiceFolderCopying\service\", strfileloc + @"\service");
            }
            ///// Code for copying (service) folder to IIS root folder.///////
        }

static public void CopyFolder(string sourceFolder, string destFolder)
        {
            if (!Directory.Exists(destFolder))
                Directory.CreateDirectory(destFolder);
            string[] files = Directory.GetFiles(sourceFolder);
            foreach (string file in files)
            {
                string name = Path.GetFileName(file);
                string dest = Path.Combine(destFolder, name);
                File.Copy(file, dest);
            }
            string[] folders = Directory.GetDirectories(sourceFolder);
            foreach (string folder in folders)
            {
                string name = Path.GetFileName(folder);
                string dest = Path.Combine(destFolder, name);
                CopyFolder(folder, dest);
            }
        }

public override void FeatureDeactivating(SPFeatureReceiverProperties properties)
        {
            string strfileloc;
            SPWeb objSPWeb = (properties.Feature.Parent as SPSite).OpenWeb();
            strport = objSPWeb.Site.Port.ToString(); //sps.Port.ToString();
           strfileloc = loc + strport;
            bool exists = System.IO.File.Exists(strfileloc + @"\service\GetPreferredContent.asmx");
            if (exists)
            {
                File.Delete(strfileloc + @"\service\GetPreferredContent.asmx"); // For Deleting the File from the Folder
                Directory.Delete(strfileloc + @"\service"); // For Deleting the Folder
            }
        }



Item does not exist The page you selected contains an item that does not exist. It may have been deleted by another user

When you do the migration from MOSS 2007 to sharepoint 2010, and if you use spcalendarview control in your custom webpart, it gives an error saying "Item does not exist The page you selected contains an item that does not exist. It may have been deleted by another user" when you click on an created event in the calendar, this is because of the text "&ID=" appended with the DisplayFormURL mentioned for the calendar property.To get rid of this issue, just add the property for Spcalendarview "EnableV4Rendering="false"



This has to resolve the issue.

For more details on this issue, please check the following link: http://social.msdn.microsoft.com/Forums/en/sharepointdevelopment/thread/e0b5d8f8-3c35-4ede-8686-c26234e847bd

Migrate SharePoint 2010 Infopath to SharePoint Online

 Below are the steps to follow to migrate the Infopath data to SP Online.