Archive for spinner

While I’m here…….

Posted in InfoPath, SharePoint, Snippets with tags , , , , , , , on April 25, 2008 by Si

I remembered a couple of other little SharePoint snippets that I have found useful.

  1. Want to use that lovely green spinning icon that SharePoint uses when its doing something? Try the SPLongOperation class – good example here.
  2. Need to set the audience for a webpart through code? This is what I used!.
  3. Get the current user in InfoPath (not strictly SharePoint, but uses the SharePoint web services). Read this.
  4. Convert the XML that SharePoint returns into a dataset (I find myself using this all the time, probably because I don’t know better!):


public DataSet NSXmlToDataSet(string xmlString)
{
DataSet ds = new DataSet();
XmlDocument xd = new XmlDocument();

xd.LoadXml(xmlString);

XmlNamespaceManager nsMgr = new
XmlNamespaceManager(xd.NameTable);
nsMgr.AddNamespace("rs",
xd.DocumentElement.GetNamespaceOfPrefix("rs"));

XmlNode xn = xd.SelectSingleNode("//rs:data", nsMgr);

XmlNodeReader reader = new XmlNodeReader(xn);
ds.ReadXml(reader);

return ds;
}

Si

Advertisements