Wednesday, December 02, 2009

Images in a dropdown list - SELECT

Rumours says that Microsoft will announce support for jQuery in SharePoint 2010, so better get started. We have used AJAX and more recently jQuery for the last 3 years in combination with SharePoint and it has proved very useful. And even if Microsoft don't support jQuery I believe it will be a major development platform for advanced end-user interfaces in the future - also for SharePoint.

Check out this example for how to enhance your existing drop down lists to include images - yes, it looks so much nicer - and navigation is like a dream.

Monday, November 30, 2009

Panel for dokumentoplysninger kunne ikke indlæses

When opening an Excel dokument based on a standard Excel XLT template stored in SharePoint I get the error outlined below. Ideas appreciated.

An English example can be found in this blog. The error Outlined is:
The form contains schema validation errors.



Content for element '{http://schemas.microsoft.com/office/2006/metadata/propertiesRoot}properties' is incomplete according to the DTD/Schema.


Expecting: {http://schemas.microsoft.com/office/2006/metadata/properties}properties.

How can this happen?

The schema is outlined at MSDN.

Errors have been reported by many here and here.

Friday, November 27, 2009

SharePoint 2010 wiki's

Using Wiki's in SharePoint 2007 can be done, but it is a first version type of product. Luckily Microsoft has announced better wiki support in SharePoint 2010 with Managed Keywords which can be used to create tag clouds and home pages can be edites as wiki's - a huge step forward for WYSIWIG editing. I found this blog interesting.

Thursday, November 26, 2009

Få forretningen til at håndtere arbejdsprocesserne

En af de centrale udfordringen at sætte strøm til arbejdsprocesser er at få forretningsbrugerne til at formulere processen og efterfølgende få denne designet og implementeret af IT folk. Der tales forskellige sprog og der er langt fra tanke til handling.

Tænk hvis det var muligt at forretningsbrugeren på en og samme tid udtrykker arbejdsgangene og dermed samtidig designer og implementerer processen i et IT system. Dermed vill man sikre at forretningsbrugeren kunne tage ansvaret for arbejdsgangene da de ikke som udgangspunkt skal have IT folk involveret i processen.

Exformatics taler på ITU seminar mandag den 7. december 2009 om udfordringerne ved at realisere en sådan tankegang.

Monday, October 26, 2009

Linking iPhone with SharePoint

Exformatics now links SharePoint with Apple iPhone in order to facilitate mobile connectivity to corporate knowledge bases. Read more here.

Here too or here.

Eller her.

Scan-Jour lukkes og Exformatics overtager.

Saturday, October 24, 2009

Creating a Web Part Page programmatically

Using Microsoft.SharePoint API is often not the most easy thing in the world. As an example adding a web part page programmatically is not an easy job - unless you're lucky and hit the right page on MSDN.

I have been trying to add a pages using the SPFolder.Files.Add(, SPTemplateFileType.StandardPage) - but the page was not added as a WebPartPage so I couldn't add web parts to the page in a proper manner.

It was not until I came across the NewWebPage method on MSDN that I managed to get the job done.

Tuesday, October 20, 2009

Explore SharePoint from F#

Check out this blog on how to explore SharePoint's object model from F#.

Monday, October 19, 2009

jQuery library for SharePoint services

Using AJAX and jQuery to retrieve data from SharePoint and present it to end-users in advanced end-user interfaces is certainly the way forward.Check out this library for more information. Looks quite promising and have done some tests.

Monday, October 12, 2009

Create a Wiki page programmatically

If you have ever tried to figure out how to create a web part page or  wiki page programmatically you'll find it very hard to find any information.

Microsoft MSDN doesn't have a lot of information.

Recently I came across this blog. So some information is out there - not much though.

Friday, September 25, 2009

Saturday, September 19, 2009

Tuesday, September 15, 2009

Updating document field value in SPItemEventReceiver.ItemCheckingIn() event handler

I need to update a property on ItemCheckingIn and came across this blog. Lucky me.

I have tried method 6
     properties.AfterProperties.ChangedProperties["Field Internal Name"] = "New Value";

but I couldn't get it working.

"Field Internal Name" should be "vti_Field Internal Name". Microsoft purchased SharePoint from a company called something with VTI. Unfortunately this didn't work either.

This blog is also worth reading as it explains the sequence of events.

Friday, August 07, 2009

Writing to SharePoint Unified Log

Writing to Windows EventLog sometimes causes issues in SharePoint, especially if using NTLM security. In this situation you might have to allow anonymous write access to the Event log by adding information to a specific registry key (Google if you wish more info on the matter).

As an alternative you can write to SharePoint own log, Unified Log, as described here on msdn.

Btw - I wonder why people in other blogs copy the content from MSDN and place it on their own blogs. What's the idea? It doesn't add any value - it only created confusion as I tend to ask myself. What is the difference?

Thursday, July 30, 2009

ItemCheckingIn and version number - MOSS SP2 behavior

Came across this blog when studying version numbering in MOSS. It's great not to be alone out here.

And in the blog it gets even better.

Thursday, July 23, 2009

Creating a site-collection programmatically

How do you create a new root site programmatically in C# or VB.Net. Check out this blog for more information.

Saturday, July 04, 2009

Office - There has been a network or file permission error

Some of our clients are occationally experiencing the following error in Office "There has been a network or file permission error".



It's hard to find an explanation for the issue but I found this blog quite interesting. Indexing services on Windows Vista could cause the problem.

Another great blog describes ways to solve it for Windows XP SP2 and Office 2007.

Friday, June 19, 2009

More on SharePoint 2010

Came across this blog on SharePoint 2010.

Thursday, June 04, 2009

ItemAdded - setting values - Microsoft recommendation

If you wish to set property values in an ItemAdded event in SharePoint - you need to create a separate thread that sleeps 10 seconds and then set the value. SharePoint is obviously not a transactional system. Read more in this blog.

Thursday, May 28, 2009

Disable property promotion/demotion

I've been looking for ways to enable/disable property promotion/demotion without luck. Finally I found someone who had worked with this - it works.

Monday, May 25, 2009

Creating a web service in F#

Check out this blog on how to create a web service leveraging Microsoft's functional programming language F#.

Monday, May 18, 2009

More on SharePoint 2010

Doing research on Microsoft SharePoint 2010 I came across various articles and I found this from Lars Fastrup quite useful. Brief and to the point.

Tuesday, April 21, 2009

SharePoint 2010

The MOSS acronym is going away as Office will be referred to as the client product only. Not certain I buy the reason for this. In fact I view Office as the whole lot - editing as well as storing and managing. But obviously Microsoft don't have the same view - or their customers don't.

Read the blog http://blogs.msdn.com/sharepoint/archive/2009/04/14/microsoft-sharepoint-14-is-now-microsoft-sharepoint-2010.aspx here.

Friday, April 03, 2009

MOSS Performance considerations

I just read this blog about performance considerations in MOSS 2007. Especially the section about SPList object is worth reading in detail.

Using the List.Items.Count should be avoided at any costs. It basically send a very complex and expensive SQL query, especially on large lists. If you need statistics use the List.ItemCount instead which uses the statistics information from SQL Server about the list to provide data. No absolutely correct though.

Wednesday, March 04, 2009

Wednesday, February 11, 2009

Very large document libraries - very strange SQL

If you ever come across the following SQL statement you need to take a critical look at various web parts other SharePoint related code recently deployed at your site.

SELECT TOP 2147483648 t2.[tp_Created] AS c3c8,t1.[Type] AS c0,t3.[tp_ID] AS c10c5,UserData.[nvarchar10],t1.[Id] AS c15,t4.[tp_Created] AS c17c8,UserData.[tp_ItemOrder],UserData.[tp_ModerationStatus],UserData.[nvarchar1],UserData.[nvarchar6],UserData.[bit2],UserData.[tp_Created],t1.[CheckinComment] AS c23,UserData.[tp_WorkflowInstanceID],t2.[nvarchar4] AS c3c6,t3.[tp_Created] AS c10c8,UserData.[ntext1],t4.[nvarchar4] AS c17c6,t1.[DirName] AS c18,UserData.[tp_ID],t1.[ProgId] AS c13,UserData.[nvarchar5],UserData.[bit1],t1.[Size] AS c21,UserData.[tp_GUID],t1.[TimeCreated] AS c1,UserData.[tp_Editor],UserData.[tp_Author],t2.[nvarchar1] AS c3c4,t3.[nvarchar4] AS c10c6,UserData.[nvarchar2],UserData.[nvarchar7],UserData.[nvarchar13],UserData.[tp_ContentType],t1.[LTCheckoutUserId] AS c20,t1.[TimeLastModified] AS c9,CASE WHEN DATALENGTH(t1.DirName) = 0 THEN t1.LeafName WHEN DATALENGTH(t1.LeafName) = 0 THEN t1.DirName ELSE t1.DirName + N'/' + t1.LeafName END AS c11,t1.[ScopeId] AS c16,UserData.[tp_ContentTypeId],UserData.[sql_variant1],t4.[nvarchar1] AS c17c4,UserData.[tp_WorkflowVersion],t1.[ParentVersionString] AS c24,UserData.[nvarchar4],UserData.[tp_CheckoutUserId],UserData.[tp_Version],UserData.[nvarchar9],t5.[nvarchar1] AS c4,UserData.[tp_IsCurrentVersion],t2.[nvarchar5] AS c3c7,t3.[nvarchar1] AS c10c4,UserData.[tp_HasCopyDestinations],UserData.[tp_Level],UserData.[nvarchar12],t1.[MetaInfo] AS c14,t4.[nvarchar5] AS c17c7,t1.[Size] AS c19,t1.[LeafName] AS c2,UserData.[tp_Modified],UserData.[nvarchar3],UserData.[nvarchar8],UserData.[tp_UIVersion],t2.[tp_ID] AS c3c5,t3.[nvarchar5] AS c10c7,UserData.[tp_CopySource],UserData.[nvarchar11],UserData.[tp_InstanceID],t1.[IsCheckoutToLocal] AS c12,t4.[tp_ID] AS c17c5,UserData.[tp_UIVersionString],t1.[ParentLeafName] AS c25 FROM UserData INNER MERGE JOIN Docs AS t1 WITH(NOLOCK) ON ( 1 = 1 AND UserData.[tp_RowOrdinal] = 0 AND t1.SiteId = UserData.tp_SiteId AND t1.SiteId = @L2 AND t1.DirName = UserData.tp_DirName AND t1.LeafName = UserData.tp_LeafName AND t1.Level = UserData.tp_Level AND (UserData.tp_Level = 255 AND t1.LTCheckoutUserId =@IU OR (UserData.tp_Level = 1 AND (UserData.tp_DraftOwnerId IS NULL OR (UserData.tp_DraftOwnerId <>@IU AND 1=0 )) OR UserData.tp_Level = 2 AND (UserData.tp_DraftOwnerId = @IU OR 1=1 )) AND (t1.LTCheckoutUserId IS NULL OR t1.LTCheckoutUserId <> @IU )) AND (1 = 1)) LEFT OUTER JOIN AllUserData AS t2 WITH(NOLOCK, INDEX=AllUserData_PK) ON (UserData.[tp_Editor]=t2.[tp_ID] AND UserData.[tp_RowOrdinal] = 0 AND t2.[tp_RowOrdinal] = 0 AND ( (t2.tp_IsCurrent = 1) ) AND t2.[tp_CalculatedVersion] = 0 AND t2.[tp_DeleteTransactionId] = 0x AND t2.tp_ListId = @L3 AND UserData.tp_ListId = @L4) LEFT OUTER JOIN AllUserData AS t3 WITH(NOLOCK, INDEX=AllUserData_PK) ON (UserData.[tp_CheckoutUserId]=t3.[tp_ID] AND UserData.[tp_RowOrdinal] = 0 AND t3.[tp_RowOrdinal] = 0 AND ( (t3.tp_IsCurrent = 1) ) AND t3.[tp_CalculatedVersion] = 0 AND t3.[tp_DeleteTransactionId] = 0x AND t3.tp_ListId = @L3 AND UserData.tp_ListId = @L4) LEFT OUTER JOIN AllUserData AS t4 WITH(NOLOCK, INDEX=AllUserData_PK) ON (UserData.[tp_Author]=t4.[tp_ID] AND UserData.[tp_RowOrdinal] = 0 AND t4.[tp_RowOrdinal] = 0 AND ( (t4.tp_IsCurrent = 1) ) AND t4.[tp_CalculatedVersion] = 0 AND t4.[tp_DeleteTransactionId] = 0x AND t4.tp_ListId = @L3 AND UserData.tp_ListId = @L4) LEFT OUTER JOIN AllUserData AS t5 WITH(NOLOCK, INDEX=AllUserData_PK) ON (t1.[LTCheckoutUserId]=t5.[tp_ID] AND t5.[tp_RowOrdinal] = 0 AND ( (t5.tp_IsCurrent = 1) ) AND t5.[tp_CalculatedVersion] = 0 AND t5.[tp_DeleteTransactionId] = 0x AND t5.tp_ListId = @L3) WHERE (UserData.tp_Level= 255 AND UserData.tp_CheckoutUserId = @IU OR ( UserData.tp_Level = 2 AND UserData.tp_DraftOwnerId IS NOT NULL OR UserData.tp_Level = 1 AND UserData.tp_DraftOwnerId IS NULL ) AND ( UserData.tp_CheckoutUserId IS NULL OR UserData.tp_CheckoutUserId <> @IU)) AND UserData.tp_SiteId=@L2 AND (UserData.tp_DirName=@DN OR UserData.tp_DirName LIKE @DNEL+N'/%') AND UserData.tp_RowOrdinal=0 AND (t1.SiteId=@L2 AND (t1.DirName=@DN OR t1.DirName LIKE @DNEL+N'/%') AND t1.Type=0) ORDER BY t1.[Type] Desc,UserData.[tp_ID] Asc OPTION (FORCE ORDER)

This blog describes a similar issue, as well as this blog. Using
targetList.Items[...]
can cause this issue. Use
targetList.GetItemByUniqueId(...) or
targetList.GetItemById(...)
instead.

Also - might be related to this issue reported by Microsoft. A hotfix exists!

Thursday, February 05, 2009

RunWithElevatedPrivileges

We have developed a series of business web services leveraging SharePoint. However, some of our users sometimes ran into security issues when their security level was Contributor.

Luckily I read this article from MSDN which describe that the
new SPSite()
requires privileges above Contributor to work. Running the code in the context of RunWithElevatedPrivileges sovles the problem. Fantastic.

Thursday, January 15, 2009

Content Type is still in use

Despite the fact that no files has the a specified content type I still get the error content type is still in use when I try to delete the content type.

I came across this blog that stated that you also needed to look into previous versions of the files as well as files hidden.

Despite the fact that I have done this I cannot delete the ContentType.

I therefore looked into the SQL database in the AllUserData table in the Content database with the following SQL
SELECT *
FROM AllUserData
WHERE (tp_DirName LIKE '%')
AND ((tp_ContentType = ''))
ORDER BY tp_DirName

Then I got a list of files using the content type.

The main issue now is that I cannot figure out how to get rid of the content type from these files. Ideas very much appreciated.

I have
  1. Checked in documents
  2. Published them all - i.e. major version
  3. Previous versions has been deleted
  4. Emptied recycle bin
  5. Ensured the content type I wish to delete is not default content type (apart from the fact that SharePoint suggest it to be the new default when uploading documents - which is strange. Maybe this is the reason?)

So what do I do?

Even if I DELETE the files and REMOVE them from recycle bin they still appear in the SQL search. No wonder I cannot get rid of the content type!

Even if I go through all files in the Document Library and explicitly set

oFile.Item("ContentType") = <...>

I cannot DELETE the content type afterwards. Very strange.

Saturday, January 03, 2009

Server Error - SPRequest.AddOrUpdateItem

When trying to upload a specific Excel document to SharePoint I get the following error:


Other documents works just fine but a few documents fails. Ideas very much appreciated. Googling find various ideas:

Server Error in '/' Application.
Oplysningerne i Microsoft Office-dokumentet 06Emails/06-1912/Attachment/ABC.xls kunne ikke opdateres. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Runtime.InteropServices.COMException: Oplysningerne i Microsoft Office-dokumentet 06Emails/06-1912/Attachment/ABC.xls kunne ikke opdateres.Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace:
[COMException (0x81071003): Oplysningerne i Microsoft Office-dokumentet 06Emails/06-1912/Attachment/ABC.xls kunne ikke opdateres.]
Microsoft.SharePoint.Library.SPRequestInternalClass.AddOrUpdateItem(String bstrUrl, String bstrListName, Boolean bAdd, Boolean bSystemUpdate, Boolean bPreserveItemVersion, Boolean bUpdateNoVersion, Int32& plID, String& pbstrGuid, Guid pbstrNewDocId, Boolean bHasNewDocId, String bstrVersion, Object& pvarAttachmentNames, Object& pvarAttachmentContents, Object& pvarProperties, Boolean bCheckOut, Boolean bCheckin, Boolean bMigration, Boolean bPublish) +0
Microsoft.SharePoint.Library.SPRequest.AddOrUpdateItem(String bstrUrl, String bstrListName, Boolean bAdd, Boolean bSystemUpdate, Boolean bPreserveItemVersion, Boolean bUpdateNoVersion, Int32& plID, String& pbstrGuid, Guid pbstrNewDocId, Boolean bHasNewDocId, String bstrVersion, Object& pvarAttachmentNames, Object& pvarAttachmentContents, Object& pvarProperties, Boolean bCheckOut, Boolean bCheckin, Boolean bMigration, Boolean bPublish) +199
[SPException: Oplysningerne i Microsoft Office-dokumentet 06Emails/06-1912/Attachment/ABC.xls kunne ikke opdateres.]
Microsoft.SharePoint.Library.SPRequest.AddOrUpdateItem(String bstrUrl, String bstrListName, Boolean bAdd, Boolean bSystemUpdate, Boolean bPreserveItemVersion, Boolean bUpdateNoVersion, Int32& plID, String& pbstrGuid, Guid pbstrNewDocId, Boolean bHasNewDocId, String bstrVersion, Object& pvarAttachmentNames, Object& pvarAttachmentContents, Object& pvarProperties, Boolean bCheckOut, Boolean bCheckin, Boolean bMigration, Boolean bPublish) +240
Microsoft.SharePoint.SPListItem.AddOrUpdateItem(Boolean bAdd, Boolean bSystem, Boolean bPreserveItemVersion, Boolean bNoVersion, Boolean bMigration, Boolean bPublish, Boolean bCheckOut, Boolean bCheckin, Guid newGuidOnAdd, Int32& ulID, Object& objAttachmentNames, Object& objAttachmentContents, Boolean suppressAfterEvents) +934
Microsoft.SharePoint.SPListItem.UpdateInternal(Boolean bSystem, Boolean bPreserveItemVersion, Guid newGuidOnAdd, Boolean bMigration, Boolean bPublish, Boolean bNoVersion, Boolean bCheckOut, Boolean bCheckin, Boolean suppressAfterEvents) +182
Microsoft.SharePoint.SPListItem.Update() +88
Microsoft.SharePoint.WebControls.SaveButton.SaveItem(SPContext itemContext, Boolean uploadMode, String checkInComment) +725
Microsoft.SharePoint.WebControls.SaveButton.SaveItem() +58
Microsoft.SharePoint.WebControls.SaveButton.OnBubbleEvent(Object source, EventArgs e) +249
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35
System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +115
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +163
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +177
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746
Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433