Wednesday, July 30, 2008

?contents=1 - broken web part

Web Parts are smart - but sometimes SharePoint makes it a little too difficult. You cannot edit the page as it's broken. Simply add ?contents=1 to the URL of the page will help you out. Check out this blog. I'm graceful.

Friday, July 25, 2008

Word did not save the document

Suddenly we consistently got the error "Word did not save the document" trying to create or update document in SharePoint.



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

Adding web parts to a page programmatically can be done through the SPLimitedWebPartManager object.

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.