Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set Sharepoint Tags/Properies with VBA

Is it possible to set the Tags of a Sharepoint document (specifically Excel) using VBA. At present the only way I know to handle this is to save a file to Sharepoint, set the Tags when prompted, nd then download this file again and use it as a template.

However, I need to work with several different permuations of these Tags and it's a major pain having to create a separate template for each one, especially if you then need to amend the template, and have to replicate those amendments 10s of times.

So is it possible to do this via VBA? I've tried recording a macro whilst I set them and it doesn't record anything regarding the Tags

like image 237
Niall Avatar asked Oct 18 '13 12:10

Niall


1 Answers

As far as I know , we can set the Tags of an Excel document in VBA before it gets uploaded onto a Sharepoint library, by settings values for the

Workbook.ContentTypeProperties

For example:

 ActiveWorkbook.ContentTypeProperties("Line of Business").Value = pLine
 ActiveWorkbook.ContentTypeProperties("Company Name").Value = pCompany
 ActiveWorkbook.ContentTypeProperties("Year").Value = pYear

I'd link some readings to learn more: It might be useful:[John Chapman's SharePoint Blog: Update SharePoint Document Property from Excel VBA]

http://www.sharepointjohn.com/sharepoint-2007-–-update-sharepoint-document-property-from-excel-vba/

Please note that there are some troubles with certain types of property: see Setting Custom Document properties that will be used in Sharepoint and this thread

like image 131
Franco Rondini Avatar answered Nov 18 '22 03:11

Franco Rondini