VBA - Sharepoint 签出和签入非 excel 文件
VBA - Sharepoint Check-out and Check-in a non-excel file
问题
Excel VBA 提供 CheckOut 和 CheckIn 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 library.
检查out/in一个文件:
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
问题
Excel VBA 提供 CheckOut 和 CheckIn 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 library.
检查out/in一个文件:
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