Updating Doc Library File that was just uploaded in VBA RRS feed

  • Question

  • Hi all,

    I'm currently writing a macro in VBA to send certain files into a sharepoint doc library and I'm stumped on one thing. I've been able to edit the metadata for the uploaded file if I can get its system ID (ID field), but say I do not know the ID- how would I edit the meta data? Example:

    ...BatchXML = "<Batch OnError='Continue' ListVersion='1' ViewName='" & ListView & "'>"
            BatchXML = BatchXML & "<Method ID='1' Cmd='Update'>"

            BatchXML = BatchXML & "<Field Name='ID'>" & "15" & "</Field>"
            BatchXML = BatchXML & "<Field Name='FileRef'>" & "//path" </Field>"

            BatchXML = BatchXML & "<Field Name='Name_x0020_of_x0020_originator'>" & "Originator" & "</Field>"
            BatchXML = BatchXML & "<Field Name='Name_x0020_of_x0020_Recipients'>" & "Recipients" & "</Field>"
            BatchXML = BatchXML & "<Field Name='Method_x0020_of_x0020_Transmission'>" & "transmission" & "</Field>"
            BatchXML = BatchXML & "<Field Name='Description0'>" & "Description" & "</Field>"...

    If I know that the file will be placed as an item with ID 15, then my code works great. But if not, my code fails to update anything. Is there a way of dynamically getting the item ID or by looking it up via the file path or some other attributes? Thanks


    Monday, June 16, 2014 9:30 PM