A Practical Guide to SharePoint 2013

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

Saturday, March 22, 2008

External Collaboration Toolkit for SharePoint released

External Collaboration Toolkit for SharePoint has been released and can be downloaded from http://www.microsoft.com/collabkit. The toolkit runs on MOSS 2007 and WSS 3.0.

Friday, March 14, 2008

How to find a node using expressions

If your main data source contains hundreds of nodes, how will you find one using expressions? Suppose "Nodes" is the parent node with the following xpath:
XPathNavigator nodes = this.CreateNavigator().SelectSingleNode("/my:myFields/my:Nodes", this.NamespaceManager);
To find nodes inside "Nodes" (parent node), do the following
nodes.SelectSingleNode("child::*[contains(name(),"abc")]");
This will select the child node that has "abc" in its name. This is just an example and can have many practical uses.

Publishing web enabled InfoPath form using STSADM command

Learn how to publish web enabled InfoPath forms using STSADM command line utility. It's simple. Admins use stsadm to publish forms. It's easy to create a batch file of commands that will remove form, deactivate form, upload form, activate form and upgrade form when needed.

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;
                }