Solved

SharePoint 2010 Document Library Document Properties

Posted on 2012-03-23
13
872 Views
Last Modified: 2013-06-04
I have a VSTO word add in that uploads  documents to a document library on a SharePoint 2010 site.  The document gets uploaded and the custom document properties which mirror the document library view columns indeed show the custom properties as uploaded.  All well and good.

However,  when I click the document on the list and launch word to edit the document,  making changes to the document custom properties and uploading.  These updated custom properties are not reflected on that document item.

I can see the properties that I modified from within Word/File/Info, but not on the updated list item.
0
Comment
Question by:Howard Bash
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 6
13 Comments
 
LVL 51

Expert Comment

by:Ted Bouskill
ID: 37760970
So the document meta properties are duplicated in the list columns?  If yes, then SharePoint will not synchronize the meta properties in the document with the list columns without additional programming.
0
 
LVL 1

Author Comment

by:Howard Bash
ID: 37761971
It does pick up the values on the initial add though?  They don't do update? That's a bummer.  So now I need to write some event listener code.  Do you have any snippets or links describing the objects I'll need to manipulate for this then?  

Seems to me if they do add the meta data values from the document on add only, this is an error in design.
0
 
LVL 1

Author Comment

by:Howard Bash
ID: 37762050
Here is what I see.  I upload the file the first time and the document set properties show up in the SharePoint list with their current values from the document meta properties.  On subsequent uploads the changed custom column values are not reflected in the list for this uploaded document update.

However,  if I open the list via windows explorer,  I can change the documents meta data in word and then drag the modified file onto the windows explorer I had openned and the updates meta data values appear in the SharePoint list.
0
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

 
LVL 1

Author Comment

by:Howard Bash
ID: 37762796
I have started looking at build an event receiver for handling the updating of an item's meta data.  

Here are the hurdles:
Not generic.  It seems to require a list by name in the setup and so this would be a problem for a site where users create lists that need this behavior.  I wonder if instead of listening for an event on a list you could instead listen for an event on a content type and you make the list based on that content type as the only requirement for list creation by users.

I tried modifying properties in a receiver and the update failed.  Here is the code and the error:


public override void ItemUpdating(SPItemEventProperties properties)
       {
           try
           {
               if (properties.ListTitle == "MyList")
               {
                   properties.ListItem["Status"] = "Modified In Rcvr Server Code";
                   properties.ListItem["MyListName"] = "MyList";
                   properties.ListItem["MyNumber"] = "9";
                   properties.ListItem.Update();
               }
           }
           catch (Exception ex)
           {
               string msg = ex.Message.ToString();
           }

           finally
           {
               base.ItemUpdating(properties);
           }
       }


ERROR FOLLOWS:

"The file \"http://mybox/sites/mysandbox/MyList/Doc2.docx\" is locked for shared use by mybox\\administrator."
0
 
LVL 51

Expert Comment

by:Ted Bouskill
ID: 37763169
You are on the right path.  If you want a generic event it has to be a feature that deploys a content type.  The feature would then be installed per site, site collection or even web application as required.
0
 
LVL 1

Author Comment

by:Howard Bash
ID: 37793108
I am able to use a listener to get to the item property and change it.  However,  when I do changes the property,  it fires that event again.  Not a good thing.  I suppose I could introduce some semaphore(s) but there must be a better event to catch the item.  I have been looking at the updated and updating events.
0
 
LVL 51

Expert Comment

by:Ted Bouskill
ID: 37793656
Yes, you need to use the Updated or Updating event.
0
 
LVL 1

Author Comment

by:Howard Bash
ID: 37797275
The problem though is that when you update a property of the list item within the handler, the handler raises the event as well.
0
 
LVL 51

Expert Comment

by:Ted Bouskill
ID: 37799403
0
 
LVL 1

Author Comment

by:Howard Bash
ID: 37800589
There are some snippets there that sound interesting. Unfortunately,  it's not clear to me exactly where theses snippets go.  For me,  a tiny complete example works better than disconnected snippets whose placement is sometimes not obvious.

Reading that link,  you will find people saying it's great stuff and also where do I put the snippets.  I fall somewhere near that group.  If you can show a more complete (tiny) complete usage of the snippets, this would be much more useful to me.
0
 
LVL 51

Accepted Solution

by:
Ted Bouskill earned 500 total points
ID: 37804629
0
 
LVL 1

Author Comment

by:Howard Bash
ID: 37892912
Yes I have.
0
 
LVL 51

Expert Comment

by:Ted Bouskill
ID: 37895500
Well as far as I can see all the details for the implementation are on that original solution.  I don't see anything that is missing.
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
reading excel file in .net 2 33
Exception when using Alea null reference in fsharp.core.dll 3 55
Installing .NET 3.5 on Windows Server 2012 1 63
Excel 2016 lost MRU list 8 71
Microsoft Word is a program we have all encountered at some point, but very few of us have dug deep into its full scope of features, let alone customized it to suit our needs. Luckily making the ribbon (aka toolbar, first introduced in Word 2007) wo…
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
This video shows and describes the main difference between both orientations in Microsoft Word. Viewers will understand when to use each orientation and how to get the most out of them.
This video walks the viewer through the process of creating Hyperlinks for the web and other documents. Select the "Insert" tab: Click "Hyperlink":  Type "http://" followed by a web address to reference a website or navigate to a document to ref…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question