Create a List Item (70-541)
Posted: 18/12/2009 Filed under: Certification, Development | Tags: 70-541, Certification Leave a comment »SPSite oSite = new SPSite("http://rootsite");
SPWeb oWeb = oSite.AllWebs["subsite"];
SPListItemCollection oItems = oWeb.Lists["list title"].Items;
// Create a New Item
SPListItem oItem = oItems.Add();
oItem["field"] = "value";
// Code that populates other fields
oItem.Update();
// Clean up
oWeb.Dispose();
oSite.Dispose();
Delete a List Item (70-541)
Posted: 18/12/2009 Filed under: Certification, Development | Tags: 70-541, Certification Leave a comment »SPSite oSite = new SPSite("http://rootsite");
SPWeb oWeb = oSite.AllWebs["subsite"];
SPListItemCollection oItems = oWeb.Lists["list title"].Items;
// Enumerate through all list items
foreach (SPListItem oItem in oItems)
{
// Delete a List Item
if(oItem["field"].ToString() == "value")
{
oItem.Delete()
return;
}
}
// Clean up
oWeb.Dispose();
oSite.Dispose();
Note, the return statement right after the item has been deleted. You do not want to keep looping through all list items once we’ve deleted the one required, as you will be thrown an exception.
Update a List Item (70-541)
Posted: 18/12/2009 Filed under: Certification, Development | Tags: 70-541, Certification Leave a comment »SPSite oSite = new SPSite("http://rootsite");
SPWeb oWeb = oSite.AllWebs["subsite"];
SPListItemCollection oItems = oWeb.Lists["list title"].Items;
// Enumerate through all list items
foreach (SPListItem oItem in oItems)
{
// Update a List Item
if(oItem["field"].ToString() == "value")
{
oItem["field"] = "new value";
oItem.Update();
return;
}
}
// Clean up
oWeb.Dispose();
oSite.Dispose();
Enumerate List Items (70-541)
Posted: 18/12/2009 Filed under: Certification, Development | Tags: 70-541, Certification Leave a comment »SPSite oSite = new SPSite("http://rootsite");
SPWeb oWeb = oSite.AllWebs["subsite"];
SPListItemCollection oItems = oWeb.Lists["list title"].Items;
// Enumerate Through All List Items
foreach (SPListItem oItem in oItems)
{
// Additional Code
}
// Clean Up
oWeb.Dispose();
oSite.Dispose();
Remove a User from a Site Group (70-541)
Posted: 17/12/2009 Filed under: Certification, Development | Tags: 70-541, Certification Leave a comment »SPSite oSite = new SPSite("http://rootsite");
SPWeb oWeb = oSite.AllWebs["subsite"];
SPGroup oGroup = oWeb.Groups["securitygroup"];
SPUser oUser = oGroup.Users["domain\\loginname"];
oGroup.RemoveUser(oUser);
oGroup.Update();
// Clean Up
oWeb.Dispose();
oSite.Dispose();
Add a User to a Site Group (70-541)
Posted: 17/12/2009 Filed under: Certification, Development | Tags: 70-541, Certification 2 Comments »SPSite oSite = new SPSite("http://rootsite");
SPWeb oWeb = oSite.AllWebs["Subsite"];
SPGroup oGroup = oWeb.Groups["SecurityGroup"];
oGroup.AddUser("domain\\loginname", "emailaddress", "username", "notes on user");
// Alternatively use oGroup.AddUser(SPUser object);
oGroup.Update();
// Clean Up
oWeb.Dispose();
oSite.Dispose();
Note: When specifying a user login name, don’t forget the domain name before (e.g: domain\\loginname). It is also not necessary to specify a user’s email address or notes on the user.
MCTS 70-631 Passed!
Posted: 11/09/2008 Filed under: Uncategorized | Tags: Certification Leave a comment »Can’t describe how happy I was after completing the Microsoft Certified Technology Specialist Windows SharePoint Services 3.0 Configuration exam (70-631) on 05/08/2008, Tuesday.
I got full marks, that’s right 1000 out of 1000!!! Really pleased with myself, as I was quite worried prior to the exam. I’ve had only about 6 months of working experience with the technology. But I must admit, that I did sacrifice a lot towards study time and made full use of the resources available (Webcasts, Virtual Labs, Documentation etc etc).
I am currently compiling my study notes together and will be posting them up shortly, so stay tuned. For now, I am just enjoying the moment of pride and relief