Solved

SharePoint 2010 Document Library Document Properties

Posted on 2012-03-23
13
879 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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Preface: When I started this series, I used the term CommandBars because that is the Office Object class that it discusses. Unfortunately, when Microsoft introduced Office 2007, they replaced the standard Commandbar menus with "The Ribbon" and rem…
Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
This video shows the viewer how to set up and create Footnotes in their document. Click on the References tab: Select "Insert Footnote": Type in desired text:
Office 365 is currently available in five editions. Three of them are for business use: Office 365 Business Essentials, Office 365 Business, and Office 365 Business Premium. Two of them are for home/personal use: Office 365 Home and Office 365 Perso…

707 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