Set Sharepoint Tags/Properies with VBA

后端 未结 2 765
清酒与你
清酒与你 2021-02-09 19:04

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 Ta

相关标签:
2条回答
  • 2021-02-09 19:32

    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

    0 讨论(0)
  • 2021-02-09 19:55

    I had the same problem. The workaround I used was as follows

    On Error Resume Next
    Application.DisplayAlerts = False
    ThisWorkbook.SaveAs Pth
    ThisWorkbook.ContentTypeProperties("Report Type").Value = "BranchManagement"
    ThisWorkbook.SaveAs Pth
    Workbooks(ThisWorkbook.Name).CheckIn
    Application.DisplayAlerts = True
    On Error GoTo 0
    

    In my case I also had to check the book in after getting it saved. Hope this helps!

    0 讨论(0)
提交回复
热议问题