A Practical Guide to SharePoint 2013

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

Sunday, April 20, 2008

MVP Summit experience

Returned from the summit on friday night but my body was so sour that I spent whole saturday sleeping, relaxing, and watching TV. This was my first summit experience and undoubtedly it was the best experience I have had in recent times. This was the first time I met SharePoint MVPs in person. I have uploaded some pictures that I took during the summit, here are the URLs:
The sessions were very informative and I got chance to spend some quality time with the other MVPs during the events like Paintball, Attendee party, PG dinner, etc. I also got chance to meet with MVPs from around the world. All in all, it was an excellent experience and I really enjoyed the visit and I hope to visit the summit again next year which is expected to start on March 1st, 2009. Those of you interested in finding out how we SharePoint MVPs had fun at the summit may want to read the following blog post:

-Saif


Friday, April 18, 2008

Permissions error when adding data to a list (programmatically)

MSDN article does not mention this but the code smaple wont work if you copy it directly from the MSDN article. You get an error when you try to add a record in list. Here is the code:
SPSite site = SPContext.Current.Site;
SPWeb localweb = site.OpenWeb();
SPList list = localweb.Lists["User List"];
SPListItem listItem = list.Items.Add();
localweb.AllowUnsafeUpdates = true;
listItem["Title"] = "test";
listItem.Update();
localweb.AllowUnsafeUpdates = false;
This will not work. First thing, you should use elevated privileges to get rid of the permissions exception. Second thing, the SPContext should be used outside the elevated privilges code. Here is how to do it correctly:

SPWeb webroot = null;
try
{
webroot = SPContext.Current.Web;
SPSecurity.RunWithElevatedPrivileges(delegate()
{
using (SPSite site = new SPSite(webroot.Site.ID))
{
using (SPWeb localweb = site.OpenWeb(webroot.ID))
{
SPList list = localweb.Lists["User List"];
SPListItem listItem = list.Items.Add();
localweb.AllowUnsafeUpdates = true;
listItem["Title"] = fname.Value.ToString();
listItem.Update();
localweb.AllowUnsafeUpdates = false;
}
}
});
Instantiate the SPWeb object to null. Assign SPContext outside elevated privileges. Set AllowUnsafeUpdates to true before updating the item.

Thursday, April 10, 2008

Programming InfoPath Web Forms

InfoPath makes it easy to create electronic forms without coding. Programming InfoPath XML forms is fun. You can take full advantage of the new InfoPath forms services by creating solutions through coding. Programming gives you power and you can do several things that may not be possible without it. For example, creating a multi-select list box for browser enabled forms is one example. The out-of-the-box multi-select list box does not work in browser forms. You can create one using the out-of-the-box repeating table. This introductory level article does not cover those details but shows how you can create a programmatic solution using VSTA.

Tuesday, April 1, 2008

MVP Renewed!

My MVP award has been renewed for another year. I am very happy and very excited because I have lots of interesting plans this year. I would like to thank all my well wishers and readers who read my blog and articles and send positive feedback and comments. Thank you!

 -SSA