A Practical Guide to SharePoint 2013

A Practical Guide to SharePoint 2013
A Practical Guide to SharePoint 2013 - Book by Saifullah Shafiq

Tuesday, February 5, 2008

SharePoint Capacity Planner Tool is now available for download

You can read about the SharePoint Capacity Planner Tool on the following page:
You can download the tool from the same page or download it directly from the following page:
You can download the System Center Capacity Planner 2007 from the following link:
The direct link to download the System Center Capacity Planner 2007 is as follows:

-SSA

Sunday, February 3, 2008

Validating contact selector control programmatically

How to know if contact selector is empty?

XpathNavigator selector = this.CreateNavigator().SelectSingleNode("/my:myFields/my:contactselector", this.NamespaceManager);
if (selector.SelectChildren(XPathNodeType.Element).Count == 0)
{
this.Errors.Add(selector, "Error","Selector is empty");
}
How to raise error if user has selected more than one person in the selector?
if (selector.SelectChildren(XPathNodeType.Element).Count > 1)
{
this.Errors.Add(selector, "Error","Please select one user");
}
How to tell if user hasn't selected a valid person?
  selector = selector.SelectSingleNode("my:Person", this.NamespaceManager);
XPathNavigator displayname = this.CreateNavigator().SelectSingleNode("/my:myFields/my:contactselector/my:Person/my:DisplayName", this.NamespaceManager);
string strDisplayName = displayname.value.toString();
XPathNavigator accountid = this.CreateNavigator().SelectSingleNode("/my:myFields/my:contactselector/my:Person/my:AccountId", this.NamespaceManager);
string strAccountid = accountid.value.toString();
XPathNavigator accounttype = this.CreateNavigator().SelectSingleNode("/my:myFields/my:contactselector/my:Person/my:AccountType", this.NamespaceManager);
string strAccountType = accounttype.value.toString();

                    if (string.IsNullOrEmpty(strDisplayName)) ||
                        string.IsNullOrEmpty(strAccountId)) ||
                        string.IsNullOrEmpty(strAccountType))
                    {
                         this.Errors.Add(selector,"Error","Please select valid user");
                    }

Note: This was off the top of my head, you may find minor mistakes in XPaths or spellings.

InfoPath: Copying content of one section to another

If you have two sections (sections can have anything including file controls) and you want to copy content from one section to another, here is how you do it:
string sourceXPath = "/my:myFields/my:Source";
string destXPath = "/my:myFields/my:Destination";
 XPathNavigator source = this.CreateNavigator().SelectSingleNode(srcXPath, this.NamespaceManager);
            XPathNavigator dest = this.CreateNavigator().SelectSingleNode(destXPath, this.NamespaceManager);
            if (dest.MoveToAttribute("nil", "http://www.w3.org/2001/XMLSchema-instance"))
                dest.DeleteSelf();
            if (source.InnerXml.Contains("xsi:nil="))
            {
                //Do nothing
            }
            else
            {
                if (dest.InnerXml.Contains("xsi:nil="))
                {
                    dest.InnerXml = source.InnerXml;
                }
                else
                {
                    dest.InnerXml += source.InnerXml;
                }



Sunday, January 27, 2008

Office SharePoint Designer 2007 Step by Step, is now in the book shops pre

Microsoft Office SharePoint Designer 2007 Step by Step is now available in the market. The book targets the Information workers. Introduction of the book can be read on the author's (Penny Coventry) blog:
Microsoft site also has some details on the book:
I will post a review of this book as soon as i get a copy.

-SSA

Sunday, January 20, 2008

Links for Workflow with VS 2008

People have already started blogging about the workflow creation with VS 2008. Here are a couple of cool links that show how to create sequential workflows using VS 2008:
Webcast:
Also, do read the following good article about VS 2008 written by Dino Esposito:

-SSA

Tuesday, January 15, 2008

InfoPath Error: The given key was not present in the dictionary.

If this error occurs when you try to submit the form, then there can be two reasons for this. The data connection name is not correct or the URL used in the data connection is not correct. Sometimes, it is hard to pin point the problem because the URL will not be accepted if it has a problem, no matter how minor. An extra space, an illegal character, etc are the problems that are hard to locate and are the source of this error. This usually occurs when you try to submit the form programmatically because directly publishing the form to the SharePoint allows you to select the site and library so there is no chance of entering a malformed URL but when you submit the form programmatically using a data connection, you have to provide the URL manually. The details of the error are as follows:
------------------
 The given key was not present in the dictionary Source: Microsoft.Office.InfoPath.Server Stack trace:   at Microsoft.Office.InfoPath.Server.DocumentLifetime.OMExceptionManager.ExecuteOMCallWithExceptions(OMCall d, ExceptionFilter exceptionFilter)
   at Microsoft.Office.InfoPath.Server.DocumentLifetime.OMSecurityContext.ExecuteOMCall(Solution solution, SecurityLevel methodSecurityLevel, ExceptionFilter exceptionFilter, OMCall d)
   at Microsoft.Office.InfoPath.Server.DocumentLifetime.OMSecurityContext.ExecuteOMCall(Solution solution, SecurityLevel methodSecurityLevel, OMCall d)
   at Microsoft.Office.InfoPath.Server.DocumentLifetime.DataConnectionCollectionHost.get_Item(String name)
   at function() in Pathcode.cs:line 394
   at function() in Pathcode.cs:line 290Location:Void ExecuteOMCallWithExceptions(Microsoft.Office.InfoPath.Server.DocumentLifetime.OMCall, Microsoft.Office.InfoPath.Server.DocumentLifetime.ExceptionFilter)
For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
---------------------------
Code to submit form programmatically:
 public void FormEvents_Loading(object sender, LoadingEventArgs e)
 {
       string srcLoc = e.InputParameters["Source"].ToString();
       srcLoc = srcLoc.Substring(0, srcLoc.IndexOf("/", 8));
       libLoc = srcLoc + e.InputParameters["XmlLocation"].ToString();
 }
FileSubmitConnection SubmitConnection = (FileSubmitConnection)this.DataConnections["Mainsubmit"];
SubmitConnection.FolderUrl = libLoc.Substring(0, libLoc.LastIndexOf("/"));
SubmitConnection.Execute();
"Mainsubmit" is the data connection name. If there is a spelling mistake in this name, you will get the error. If there is a spelling mistake in the URL used in this connection, again there will be an error. You need to be extra careful when publishing the form. It is hard to notice the problem because the form publishes OK with out any problems and you only get the error when you run the form from SharePoint.