VBA-Sharepoint签出和签入非excel文件



问题

Excel VBA提供了签出和签入Excel工作簿的方法,如下所示:

if workbooks.CanCheckOut(sFile) then
workbook.CheckOut(sFile)
set wb = workbooks.open(sFile)
'make changes
wb.CheckIn true, "Some comment", true
end if

但是,如果我试图签出一个文本文件(或任何其他文件(,我该如何做到这一点?

我制作了一个sharepoint库。

签出/放入文件:

Dim sp as stdSharepointSite
set sp = stdSharepointSite.Create("teams","http://teams/wholesale/Leicester", "myUser", "myPass")
if sp.CheckOutFile("http://teams/wholesale/Leicester/myFile.txt", false) then
'Can and have checked out
'Do stuff

if thereAreChanges then
'save file to sharepoint
'...
'check in changes
sp.CheckInFile("http://teams/wholesale/Leicester/myFile.txt", "Updated my file")
else
'Discard checkout
sp.CheckOutDiscard("http://teams/wholesale/Leicester/myFile.txt")
end if
else
'Cannot checkout...
end if

最新更新