Archive

Archive for the ‘Programming’ Category

Does the SP List Exist?

September 26th, 2011 No comments

The SharePoint Lists web service is very useful and method rich for working with SharePoint lists, however one issue I ran in to recently left me wanting.

I had a series of tasks to code and one was to determine if a SharePoint list exists in one primary default location and if it did use that list but if it did not I would bind to another list in a backup location.

The Lists web service does not have an Exists method so I created this function below to do the job for me.

 

   1:  private static bool ListExists(string webUrl, string list)
   2:  {
   3:      try
   4:      {
   5:      Lists lists = new Lists();
   6:      lists.Credentials = CredentialCache.DefaultCredentials;
   7:      lists.PreAuthenticate = true;
   8:      if (webUrl.EndsWith("/"))
   9:          lists.Url = webUrl + "_vti_bin/lists.asmx";
  10:      else
  11:          lists.Url = webUrl + "/_vti_bin/lists.asmx";
  12:      try
  13:      {
  14:          XmlNode xmlList = lists.GetList(list);
  15:          return true;
  16:      }
  17:      catch (Exception ex)
  18:      {
  19:          Trace.WriteLine(ex.Message + " " + ex.StackTrace);
  20:          return false;
  21:      }
  22:      }
  23:      catch (Exception ex)
  24:      {
  25:      Trace.WriteLine(ex.Message + " " + ex.StackTrace);
  26:      return false;
  27:      }
  28:  }

 

If GetLists works then xmlList object will contain a XML scheme document, list exists.  If the list does not exist a SOAP exception will be trapped and the ListExists method returns false.

For more information see: Lists.GetList Method

Document Property Parsing

July 29th, 2011 No comments

ParserEnabled, True or False

Document Property Promotion and Demotion is a mechanism in SharePoint where by the Microsoft Office documents properties are parsed and added to the documents metadata fields in the target document library.  This feature is exposed and most prominently seen in the Document Information Panel (DIP) of the Microsoft Office suite of applications.

This is a great feature and works well for most solutions, however, there are always exceptions.  If your solution calls for batch loading documents via a RPC utility with custom metadata the Document Parsing will drop the custom metadata and override it with the parsed values from the embedded document properties.

In order for you to avoid this you need to disable the ParserEnabled property of the web application, this is not something you can do via STSADM or the Central Administration UI.

You’ll need to code this with Visual Studio .NET or use Joe Rodgers PowerShell script example below to disable the parsing.  I’ve created an small UI utility (DPP.EXE) that you can find on my Code page to accomplish this easily.   In hind sight however, after I coded this utility and have seen all the support for PowerShell in SP2010, I’d recommend using PowerShell as much as possible for all your administrative tasks on your MOSS server at this point.

 

image_3

DPP source code is available here.

 

Inside the DOCPARSE.XML File

Located in the 12 hive in the config folder is the DOCPARSE.XML file that contains the parsers available to the server.

C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\CONFIG\DOCPARSE.XML

clip_image001

 

For More Information

Categories: MOSS, Programming, WSS Tags: ,