SharePoint Blog - René Hézser

Anmelden  RSS Feed RSS Feed
Startet die Suche

Archive

Kategorien

Links

Andere Blogs




ITaCS GmbH

Jan 302009

SharePoint Dispose Checker Tool

As I posted earlier, MS was working on a tool which will analyze your code if you are coding against SharePoint.

Here is a short description:

It provides assistance in correctly disposing of certain SharePoint objects to help you follow published best practice. This tool may not show all memory leaks in your code. Further investigation is advised if you continue to experience issues.
SPDisposeCheck.exe takes the path to a managed .DLL or .EXE or the path to a directory containing many managed assemblies. It will recursively search for and analyze each managed module attempting to detect coding patterns based on the MDSN article.

http://code.msdn.microsoft.com/SPDisposeCheck

Download the SPDisposeCheckerTool

Best Practices: Using Disposable Windows SharePoint Services Objects


Published: 1/30/2009  8:20 AM | 0  Comments | 0  Links to this post
Tagged as: Development, SharePoint

Jan 292009

Upgrading a solution fails

In a SharePoint farm with multiple servers, features have to be deployed to every server. No problem you would think. That is why we got solutions and deploy them with stsadm. SharePoint will do the rest.

But what do you do if you got an error during the deployment process?
In my case the error was:

A deployment or retraction is already under way for the solution xyz, and only one deployment or retraction at a time is supported.

I went through the ULS logs, and found this:

The job definition "Microsoft.SharePoint.Administration.SPSolutionDeploymentJobDefinition" (id "4e323369-0cc7-4cd7-ae90-850e6706df08") requires the Administration Windows Service ("SPAdmin"), but this service is not currently running.

The entry appeared on the last server I checked…
The next steps to get the solution upgraded are:

  1. delete the deployment timer definition (Central Administration > Operations > Timer Job Definitions)
  2. upgrade the solution with stsadm –o upgradesolution

 

Technorati Tags: ,,


Published: 1/29/2009  9:15 AM | 0  Comments | 0  Links to this post
Tagged as: SharePoint, Solution

Jan 202009

SharePointPodcast

Heute habe ich mit Michael Greth einen Podcast aufgenommen. In diesem erzähle ich über die CKS:EBE (Enhanced Blog Edition), einige meiner Webparts und meinen Vortrag auf der SharePoint Konferenz im nächsten Monat.

http://blogs.mysharepoint.de/sharepointpodcast/archive/2009/01/20/sppd109-sharepointpodcast.aspx

Technorati Tags: ,,

Published: 1/20/2009  9:59 PM | 0  Comments | 0  Links to this post
Tagged as: Sonstiges, SharePoint

Jan 192009

SharePoint Web Controls to access remote content

In my post How to use the SharePoint Web Controls I talked about using the SharePoint Web Controls to show and edit data in SharePoint lists.

Today I want to post a sample how to work on a list, which is in another web. The remote list will be the "User Information List" which exists on every rootWeb.

   1:  // connect to the rootweb, to read the users list
   2:  var rootWeb = SPContext.Current.Site.RootWeb;
   3:  {
   4:      // get the current user and corresponding item in the user information list
   5:      SPUser user = SPContext.Current.Web.CurrentUser;
   6:      SPList list = rootWeb.Lists["User Information List"];
   7:      SPListItem userItem = list.GetItemById(user.ID);
   8:   
   9:      // set the context, so the controls will work
  10:      SPContext context = SPContext.GetContext(
  11:          HttpContext.Current, userItem.ID, list.ID, rootWeb);
  12:   
  13:      // Username
  14:      Controls.Add(new Label { Text = "Username:" });
  15:      var username = new TextField
  16:      {
  17:          ID = "Username",
  18:          FieldName = "Title",
  19:          ItemId = userItem.ID,
  20:          ListId = list.ID,
  21:          ControlMode = SPControlMode.Edit,
  22:          RenderContext = context,
  23:          ItemContext = context
  24:      };
  25:      Controls.Add(username);
  26:   
  27:      // about me
  28:      Controls.Add(new Label { Text = "About me:" });
  29:      var aboutMe = new RichTextField
  30:      {
  31:          ID = "AboutMe",
  32:          FieldName = "Notes",
  33:          ItemId = userItem.ID,
  34:          ListId = list.ID,
  35:          ControlMode = SPControlMode.Edit,
  36:          RenderContext = context,
  37:          ItemContext = context
  38:      };
  39:      Controls.Add(aboutMe);
  40:  }

The key point is to create a context, which is different from the current. This new context will be used by the SharePoint Web Controls to render data from the User Information List. The output would be something like this:

If you do not set the context for the controls and try to access data from another context (which you try if you specify the list from another web), you will get an InvalidOperationException.

Operation is not valid due to the current state of the object.

Technorati Tags: ,


Published: 1/19/2009  5:41 PM | 1  Comment | 1  Links to this post
Tagged as: Development, SharePoint, Web Controls