While I’m here…….
I remembered a couple of other little SharePoint snippets that I have found useful.
- Want to use that lovely green spinning icon that SharePoint uses when its doing something? Try the SPLongOperation class – good example here.
- Need to set the audience for a webpart through code? This is what I used!.
- Get the current user in InfoPath (not strictly SharePoint, but uses the SharePoint web services). Read this.
- 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
May 14, 2008 at 16:09
Si Si senior
Thanks.