Wednesday, July 30, 2008
?contents=1 - broken web part
Friday, July 25, 2008
Word did not save the document

We tried to research the problem using Google but didn't really find an answer - something we found quite strange. Then we checked the SharePoint log-files found in
C:\Program Files\Common Files\Microsoft Shared\Web server extensions\12\Logs
and voila, we could locate the issue in the log-file, outlined below:
07/25/2008 11:20:13.31 w3wp.exe (0x1054) 0x1364 Windows SharePoint Services General 72ng Medium RPC method = put document 07/25/2008 11:20:13.31 w3wp.exe (0x1054) 0x1364 Windows SharePoint Services General 72n3 Medium put file doc URL = 07Docs/07-1521/New document.docx 07/25/2008 11:20:13.40 w3wp.exe (0x1054) 0x1364 Windows SharePoint Services Database 6f8g Unexpected Unexpected query execution failure, error code 9002. Additional error information from SQL Server is included below. "The transaction log for database 'INTRANET_Content' is full. To find out why space in the log cannot be reused, see the log_reuse_wait_desc column in sys.databases" Query text (if available): "DECLARE @@S uniqueidentifier; DECLARE @@DocId uniqueidentifier; DECLARE @@Level tinyint; DECLARE @@DocUIVersion int; DECLARE @@DoclibRowId int; DECLARE @@iRet int;DECLARE @DN nvarchar(256); DECLARE @LN nvarchar(128); DECLARE @FU nvarchar(260); SET @@Level=255 SET @@DocUIVersion =1 SET @@DocId='331203E1-CF23-4BE5-A306-B53A7F289DDF' SET @@S='9E4A9A77-CF3E-4881-9E6A-AADF9B17AB86'; EXEC @@DoclibRowId = proc_GenerateNextId 'D44ED427-5B4E-4AE0-AC38-BDDB2E54142E','2E51B790-B64E-43... 07/25/2008 11:20:13.40* w3wp.exe (0x1054) 0x1364 Windows SharePoint Services Database 6f8g Unexpected ...5F-A1F2-253C7ADCD4C4'; SET @DN=N'Sager/07Docs/07-1521'; SET @LN=N'New document.docx';BEGIN TRAN; EXEC @@iRet = proc_AddDocument '9E4A9A77-CF3E-4881-9E6A-AADF9B17AB86','D44ED427-5B4E-4AE0-AC38-BDDB2E54142E',1,NULL,@DN, @LN OUTPUT, @@Level, @@DocUIVersion, @@DocId,'2E51B790-B64E-435F-A1F2-253C7ADCD4C4',@@DoclibRowId,?,?,54317,1274,1,0,332,NULL,NULL,0,2097153,0,0,0,-2,NULL,0,NULL,NULL,NULL,NULL,NULL,? OUTPUT,0,?,? OUTPUT; SET @FU = dbo.fn_GetFullUrl(@DN, @LN); IF @@iRet <> 0 GOTO done; EXEC proc_DirtyDependents @@S,1,@FU;IF @DN IS NULL SET @DN=N'Sager/07Docs/07-1521'; IF @LN IS NULL SET @LN=N'New document.docx'; EXEC @@iRet =proc_AddListItem @WebId='D44ED427-5B4E-4AE0-AC38-BDDB2E54142E',@SiteId='9E4A9A77-CF3E-4881-9E6A-AADF9B17AB86',@ListID='2E51B790-B64E-435F-A1F2-253C7ADCD4C4',@ItemId=@@Do... 07/25/2008 11:20:13.40* w3wp.exe (0x1054) 0x1364 Windows SharePoint Services Database 6f8g Unexpected ...clibRowId,@UIVersion=@@DocUIVersion,@RowOrdinal=0,@DocIdAdded='331203E1-CF23-4BE5-A306-B53A7F289DDF',@Size=0,@ItemName=N'New document.docx',@ItemDirName=@DN OUTPUT,@ItemLeafName=@LN OUTPUT,@ItemDocType=0,@UserId=1,@Level=@@Level, @TimeNow='20080725 09:20:12', @tp_ContentTypeId = ?,@nvarchar1=?,@nvarchar2=?,@nvarchar3=?,@nvarchar7=?,@nvarchar14=?,@nvarchar15=?,@sql_variant1 = 0, @error_sql_variant1 = 3,@tp_ContentType=?,@tp_ModerationStatus=?,@acl=NULL; IF @@iRet<> 0 GOTO done; SELECT @@iRet, @@DoclibRowId; done: IF @@iRet=0 BEGIN COMMIT; EXEC proc_GetLinkInfoSingleDoc @@S,@DN,@LN,@@Level; END ELSE ROLLBACK; SET ?=@@iRet;"
Quite simple really - the log file was full and no disk space available.
Thursday, July 10, 2008
Add a Web Part to SharePoint Page Programmatically
However, if you plan to store you web part's in galleries you need to retrieve them. Web Part Galleries are just traditional SharePoint lists, so you'll need to search through the list, and retrieve the content of the item in order to retrieve the web part xml. SharePoint doesn't offer any special Web Part lists.
The blog describes the model fairly detailled.
Monday, June 02, 2008
Document parsers in SharePoint - Office 2003 and 2007 promote-demote differently
However, this blog describe the concept of setting up property promote-demote. The DocParse.xml file is quite interesting - as Office 2003 and Office 2007 doesn't behave equally for property promotion-demotion. The reason could be this file - as the "doc" extension is not included, and SharePoint maybe for that reason uses another algoritm, thus leading to another result!
From this blog:
WSS includes built-in document parsers for the following file types:
- OLE: includes DOC, XLS, PPT, MSG, and PUB file formats
- Office 2007 XML formats: includes DOCX, DOCM, PPTX, PPTM, XLSX an XLSM file formats
- XML
- HTM: includes HTM, HTML, MHT, MHTM, and ASPX file formats
You cannot create a custom document parser for these file types. With the XML parser, you can use content types to specify which document properties you want to map to which content type columns, and where the document properties reside in your XML documents.
Wednesday, May 07, 2008
Connect to Outlook - scripting
The stssync protocol, outlined at msdn, is used to enable the synchronization to happen.
If you click Connect to Outlook as outlined below

Outlook will then display the following menu

Clicking advanced will bring up this menu

Various tools exists to enabel two-way synchronization between SharePoint and your desktop, of which Microsoft provide Groove as a part of Office while Colligo Contributor seems a far better solution as outlined in this blog. Also refer to this blog for relevant information about how to access information in SharePoint from OWA.
function ExportHailStorm(type,weburl,guid,webname,listname,viewurl,passport,listrooturl,folderurl,folderid)
Thursday, April 10, 2008
Google Maps in SQL Server - 2005 and 2008
Leveraging Google Maps enable you to build a simple web part which can map the address of a contact to a map in Google. Awesome. AJAX today - maybe jQuery in the near future.
Wednesday, April 02, 2008
ItemAdded - listItem is null
Sunday, March 30, 2008
Change approval status without changing ModifiedBy property on a document
When we move or copy the file we include properties as well as versions with Createdy, ModifiedBy, TimeCreated and TimeLastModified. Everything works fine except for one issue.
When we publish a document using SPFile.Publish() the ModifiedBy and TimeLastModified are changed - therefore we lose the version history.
Instead we try to fix the issue using the comment field - somehow it solves part of the issue but we would appreciate a better solution.

We have tried changing
oFile.Publish([comment])
to
oFile.Item.ModerationInformation.Status = SPModerationInformation.Approved
oFile.Item.ModerationInformation.Comment = [comment]
oFile.Item.SystemUpdate(false)
but unfortunately ModerationInformation is not available on the SPFile object.
This blog mention the same issue - without a solution. Ideas appreciated.As our last resort we're currently investigating creating a stored procedure which modified the SharePoint SQL database behind the scene. We would prefer not using this solution (albeit it works).
Monday, March 24, 2008
One of more field types are not installed properly
Unfortunately I get the error when I try to delete the field from SharePoint using oDocLib.Fields.Delete(
Fortunately this blog gave me some hints.
Sunday, February 03, 2008
Programmatically adding web parts to pages - audience targeting
For some web parts we wish to control audience, and to my luck I came across this page describing how to do this. However, understanding the AuthorizationFilter is a challenge.
Reverse engineering is probably the answer ... will update once I have figured this out.
Friday, January 18, 2008
Avoid checkin when uploading files
This can happen even for Document Libraries without versioning - and changing it to avoid checkin is not simple.
You need to ensure at least that:
- Require documents to be checked out before they can be edited = false
- No versioning af Document library - probably not required
- Ensure no mandatory columns exists - or ensure they have default values
Check out this blog for information.
Saturday, January 05, 2008
Copy files between document libraries
Instead, you need to traverse all versions of a document, which raises a critical issue. How to ensure the created, createdby, modified and modifiedby properties to be the same in the new document as in the old.
SPFileCollection contains an Add method to add new files. Unfortunately it doesn't exists with all the parameters needed, i.e. properties as well as created, createdby, modified and modifiedby. This method is missing:
SPFileCollection.Add (String, Byte[], Hashtable, Boolean, SPUser, SPUser, DateTime, DateTime)
As this method doesn't exists you have two options.
- Copy document with properties - and fix dates and users manually afterwards
- Copy document with dates and users - and fix properties manually afterwards
Both methods raises some issues - as you need to manipulate the SPFile and SPListItem object directly.
Manually manipulating createdby can be done as sketched below:
listitem["Created"] = new DateTime(2006, 11,1);
listitem["Modified"] = new DateTime(2006, 12,1);
listitem.UpdateOverwriteVersion();
as outlined on MSDN. Unfortunately this code doesn't work :-(
Other ideas very much appreciated.
Check out other blogs, such as this. Unfortunately it doesn't addess all the issues.
Hint to a solution?
Various investigations led me to analyzing the properties of the listitem after having added the item. It turns out that:
listitem[SPBuiltInFieldId.Created]
listitem[SPBuiltInFieldId.Created_x0020_Date]
are not equal! Created_x0020_Date contains the value of li["Created"] whereas SPBuiltInField.Created was the time the document was added to SharePoint.
This is even the case in situations where you use the
SPFileCollection.Add (String, Byte[], SPUser, SPUser, DateTime, DateTime)
which was a surpise to me !
Saturday, December 22, 2007
Google Maps and SharePoint

This blog describe how to inline a simple Google Map in SharePoint. Check out this link for documentation.
If you wish to learn more don't hesitate to contact me.
Saturday, December 01, 2007
Content By Type Web Part
Sunday, November 18, 2007
Large content databases - added indexes for performance improvements
As only a few properties are contained in indexes searches will most likely lead to table-scans. Having a few 1.000 documents in SharePoint might not lead to slow performance but if you're looking at 100.000+ documents the situation is obviously different as outlined in this excellent article.
Thursday, November 08, 2007
Potentially excessive number of SPRequest objects currently unreleased on thread
In order to avoid the problem in your code ensure to properly dispose the SPWeb object as outlined in this Microsoft article as well as in this blog. One important thing missing is the SPWeb.Webs() object - if using this object you also need to dispose all webs within the collection.
Potential reasons include:
- Invalid XSL stylesheet
- Drop down lists - simple C# example
- Orphans
Friday, November 02, 2007
SharePoint Content Database
Where is my content type used
DECLARE @ContentTypeName nvarchar(128)
SET @ContentTypeName='Document'
SELECT w.Title AS [Web Site], w.FullUrl AS [Web Url], al.tp_Title AS [List Title], ct2.* FROM ContentTypes ct1 JOIN ContentTypes ct2 ON LEFT(ct2.ContentTypeId, Len(ct1.ContentTypeId))=ct1.ContentTypeId LEFT OUTER JOIN dbo.ContentTypeUsage ctu ON LEFT(ctu.ContentTypeId, Len(ct2.ContentTypeId)) = ct2.ContentTypeId LEFT OUTER JOIN dbo.AllLists al ON ctu.ListId = al.tp_Id AND ctu.WebId=al.tp_WebId LEFT OUTER JOIN dbo.Webs w ON al.tp_WebId = w.Id WHERE ct1.ResourceDir=@ContentTypeName