document workspace and quickpart problem
Hi,
I've a strange behavior when using the document workspace :
I have a document library that is bound to a custom content type. The content type adds a user field.
I create a document using this content type, and I add a quickpart in the document that show the value of the field.
this is working correctly, I can edit my document, and everything works fine, until I use the document workspace feature...
I then use the send to menu to create the document workspace the workspace is created, and when I "Publish to the source" I got the following exception :
Invalid look-up value
A look-up field contains invalid data. Please check the value and try again.
at Microsoft.SharePoint.Library.SPRequestInternalClass.PutFile(String bstrUrl, String bstrWebRelativeUrl, Object varFile, PutFileOpt PutFileOpt, String bstrCreatedBy, String bstrModifiedBy, Int32 iCreatedByID, Int32 iModifiedByID, Object varTimeCreated, Object varTimeLastModified, Object varProperties, String bstrCheckinComment, UInt32& pdwVirusCheckStatus, String& pVirusCheckMessage)
at Microsoft.SharePoint.Library.SPRequest.PutFile(String bstrUrl, String bstrWebRelativeUrl, Object varFile, PutFileOpt PutFileOpt, String bstrCreatedBy, String bstrModifiedBy, Int32 iCreatedByID, Int32 iModifiedByID, Object varTimeCreated, Object varTimeLastModified, Object varProperties, String bstrCheckinComment, UInt32& pdwVirusCheckStatus, String& pVirusCheckMessage)
After some investigations, I found that the problems is caused by the user field. (this post put me on the way :
Uploading documents with conflicting document properties ).
In the advanced property windows of Word, I can see a custom property with my custom field name.
The value of the property equals "Firstname Lastname1", where 1 is the ID of the user if my SPSite.
If I update the value to "1#Firstname Lastname", the problem disappear and I can send my document to its original location.
As I'm using the OOB document workspace feature, I can't put a c# code to catch and hack the file copy. How can I workaround this ?
thanks,
Steve
PS: the definition of my field is similar to this one :
<Field Type="User"
DisplayName="my field"
Mult="false"
UserSelectionMode="0"
UserSelectionScope="0"
Group=" mygroup"
ID="{E012E544-8EEC-498c-88BD-E6E916C6F75E}"
SourceID="http://schemas.microsoft.com/sharepoint/v3"
Name="myfield"
Hidden="FALSE"
ReadOnly="True"
ReadOnlyEnforced="True"
ShowInDisplayForm="TRUE"
ShowInNewForm="FALSE"
ShowInEditForm="FALSE"
ShowInFileDlg="True"/>
Note that the field is purely read-only for the user. There is workflow that update the value of the field, but I think that does not change anything.
Paying back the community for its help by writing articles :
Have a Nice Day.Net Blog
July 23rd, 2010 4:25pm
After a long search, I am able to isolate the problem :
the document workspace's document library does not contains the column used in the quickpart
Word store this value in its properties using a string transformation of the xml node
the following xml part in the word document:
<
MyColumn
xmlns
=
"
http://schemas.microsoft.com/sharepoint/v3
"
>
<
ns1
:
UserInfo
xmlns:ns1
=
"
http://schemas.microsoft.com/sharepoint/v3
"
>
<
ns1
:
DisplayName
>
My User</
ns1
:
DisplayName
>
<
ns1
:
AccountId
>
1</
ns1
:
AccountId
>
<
ns1
:
AccountType
>
User</
ns1
:
AccountType
>
</
ns1
:
UserInfo
>
</
MyColumn
>
is lost when the document is copied in the workspace. Instead, the value "My User1" is stored in the document properties.
When the document is sent to the original library, SharePoint try to convert the "My User1" to SPUserFieldValue ... which it cannot because the expected format is "1#My User"
In order to workaround this behavior, I've done the following steps :
I created a new custom action placed in the document menu the custom action have an UrlAction element set to a custom page in layouts vfolder
the page, in the load method do everything necessary :
Create the document workspace set the shared document library to use the source document's content type copy the document
using these steps create a document workspace that have the same content type as the source document. In these case, the document keep it's xml part and when the user send the document to the source library, the word parse processor is happy.
Hope that helps.
steve
PS: @ Mike walsh : why did you move this thread to the admin forum ???
Paying back the community for its help by writing articles :
Have a Nice Day.Net Blog
Free Windows Admin Tool Kit Click here and download it now
July 27th, 2010 11:21am


