Sunday, July 1, 2012

Open SharePoint management forms in new page

If you want to open SharePoint Form in new page instead of popup:
  1. Right Click in popup page and copy the url.
  2. Remove IsDlg=true from query string.
  3. You need yo modify return url adjust root folder and source url.

    Url will be as below:
    /news/_layouts/SubNew.aspx?List={B2AE3C44-1965-447F-BFEF-D87706BE51DD}&RootFolder=&source=/

SharePoint Plan browser support

These articles describe different levels of Web browser support
Office SharePoint Server 2007:
http://technet.microsoft.com/en-us/library/cc263526%28v=office.12%29.aspx

SharePoint Server 2010:
http://technet.microsoft.com/en-us/library/cc263526.aspx

Monday, June 11, 2012

SharePoint Batch Insert/Update/Delete Performance

When you want to do bulk transaction insert, update, or delete.
If you have to update a larger number of items its highly recommended to not use the Update method on every item. Instead – use the batch update function ProcessBatchData provided by SPWeb.

StringBuilder query = new StringBuilder();
for (int itemIx=0;itemIx<100;itemIx++) {
  query.AppendFormat("" +
          "{1}" +
          "New" +
          "Save" +
          "{2}" +
       "", i, listGuid, someValue, "urn:schemas-microsoft-com:office:office#");
}
SPContext.Current.Web.ProcessBatchData("" +
    "{0}", query.ToString())

For more details of using ProcessBatchData check url:
http://stefan-stanev-sharepoint-blog.blogspot.com/2009/07/tips-for-using-spwebprocessbatchdata.html


Adding XsltListViewWebPart to sitedefinitions

If you want to add XsltListViewWebPart with custom xslt to site definition:
  1. Create a web part and do all configuration in existing site. Then export the web part this web part need some modifications to add to site definition.
  2. Exported Web Part contains ListGuid Which is difference from site to other. Remove ListGuid. Add one from these properties  ListName, ListUrl, or ListDisplayName
    One of the List* properties (ListName, ListUrl, or ListDisplayName) must be present and must specify a reference to a valid list. If more than one property is present, the order of evaluation is ListName, then ListUrl, and then ListDisplayName.
 

Add SPNavigation Heading programmatically

If you want to add header without link to SharePoint Navigation pro-grammatically,  Need to set some values in the NavigationNode.Properties HashTable.


            SPNavigationNode node, node1;
            // Get the parent’s top link bar.
            SPNavigationNodeCollection topnav = web.Navigation.TopNavigationBar;

            // Create the node.
            node = new SPNavigationNode("News", "/news", true);
            topnav.AddAsLast(node);

            node = new SPNavigationNode("Services", string.Empty, true);
            node = topnav.AddAsLast(node);
            node.MakeHeaderNode();
            node1 = new SPNavigationNode("IT Support", "/Services/Lists/Helpdesk Initiation/NewForm.aspx?RootFolder=&source=/", true);
            node.Children.AddAsLast(node1);


public static class SPNavigationNodeExtensions
{
    public static void MakeHeaderNode(this SPNavigationNode node)
    {
        node.Properties["BlankUrl"] = "True";
        node.Properties["LastModifiedDate"] = DateTime.Now;
        node.Properties["Target"] = "";
        node.Properties["vti_navsequencechild"] = "true";
        node.Properties["UrlQueryString"] = "";
        node.Properties["CreatedDate"] = DateTime.Now;
        node.Properties["Description"] = "";
        node.Properties["UrlFragment"] = "";
        node.Properties["NodeType"] = "Heading";
        node.Properties["Audience"] = "";
        node.Update();
    }
}
As you can see, the “BlankUrl'” = True, and NodeType = “Heading”.

Sunday, June 10, 2012

Update PublishingImages using list.asmx

It takes from me too long time before success update PublishingImage Column using list.asmx.
We should pass value relative url with alt separated by comma. This is also applied for url, lookup, or user.
Check example below:
 string xml = ""+
        ""+
        "    1"+
        "    http://www.pub.com/publishingimages/test.jpg, test"+
       
"+

"       ";

Friday, June 1, 2012

SharePoint designer 2010 soap:Server was unable to process request. ---> Value does not fall within the expected range

When try to edit any page using SP Designer error  soap:Server was unable to process request. ---> Value does not fall within the expected range appear. 


When you face the following error check:
  1. Check from Site Collection Administration SharePoint Designer Settings and Enable the following:
    • Enable Detaching Pages from the Site Definition
    • Enable Customizing Master Pages and Page Layouts
    • Enable Managing of the Web Site URL Structure
  2.  Check Url exist in alternate access mapping.
  3. Check your dns client.