Tuesday, August 05, 2008

Talking about Develop on SharePoint webcast series

Quote

Develop on SharePoint webcast series

In this 10-part series, you will receive practical technical information from Robert Bogue and Andrew Connell, Microsoft SharePoint Most Valuable Professionals (MVPs), covering 10 fundamental developer topics on SharePoint Products and Technologies via Live Meeting Webcast.

20-May-08 ... Introduction to SharePoint for .NET Developers: Web Parts. Register
21-May-08 ... Introduction to SharePoint for .NET Developers: Data Lists. Register
27-May-08 ... Introduction to SharePoint for .NET Developers: Silverlight and SharePoint. Register
28-May-08 ... Introduction to SharePoint for .NET Developers: Using Event Handlers. Register
03-Jun-08 ... Introduction to SharePoint for .NET Developers: Page Branding. Register
04-Jun-08 ... Introduction to SharePoint for .NET Developers: Workflows. Register
10-Jun-08 ... Introduction to SharePoint for .NET Developers: Web Services. Register
11-Jun-08 ... Introduction to SharePoint for .NET Developers: Page Navigation. Register
17-Jun-08 ... Introduction to SharePoint for .NET Developers: User Management. Register
18-Jun-08 ... Introduction to SharePoint for .NET Developers: Custom Content Types. Register

Creating MOSS 2007 Theme


  1. On the SharePoint server go to the Themes folder e.g. c:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\Themes
  2. Make a copy one of the existing theme folders and its contents rename it e.g. MyTheme.
  3. Rename the .INF file within the MyTheme folder to MyTheme.INF
  4. Edit MyTheme.INF.

    1. At the info section, Change the title, to MyTheme. Change codepage, e.g 22200, replacing the code page will fixing error “A theme with the name “MyTheme 1011″ and version already exists on the server.”
    2. In the titles section, rename the names to your new name. this section is to present the name in the different language.

  5. Provide an image to give a preview of your theme. This image should be placed in C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\IMAGES. E.g. tmbMyTheme.gif
  6. Modify the c:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\Layouts\1033\SPTHEMES.xml to include a reference to the new MyTheme theme

    <Templates>
    <TemplateID>MyTheme</TemplateID>
    <DisplayName> MyTheme </DisplayName>
    <Description> MyTheme has a white background with blue control areas and orange highlights.</Description>
    <Thumbnail>images/tmbMyTheme.gif</Thumbnail>
    <Preview>images/ tmbMyTheme.gif</Preview>
    </Templates>

  7. Modify the CSS within MyTheme folder to personalize your theme.
  8. Run iisreset from the command prompt
  9. Apply the new theme to a “test site”,.

Impersonation in SharePoint 2007 OM

Whenever you are developing anything for SharePoint 2007 and that piece of code needs to perform some admin tasks which are not possible with the current user context, you are left with no other option but to impersonate.

Impersonation within SharePoint 2003 was not so easy. Although you can find the helper class easily on Internet but still you need to add that class to your solution and perform few calls which sometimes becomes quite irritating. It was a common issue with SharePoint 2003.

Thankfully, that issue has been addressed in SharePoint 2007 and now we have impersonation as part of SharePoint OM. It is as easy as calling a delegate. If you are familier with anonymous methods, you can get the idea from the following piece of code that how easy it is to elevate user's rights within SharePoint 2007.

SPWeb web = SPContext.Current.Web;
SPUser user = web.CurrentUser;

// the calling user

// Uses the SHAREPOINT\system creds with the SPUser's identity reference of user SPSecurity.RunWithElevatedPrivileges(delegate() {

web.AllowUnsafeUpdates = true;
SPList theList = web.Lists[listName];
SPListItem record = theList.Items.Add();
record["User"] = user;
// calling user
record.Update();
web.AllowUnsafeUpdates = false;

});