如何在sharepoint上签入文件?

Posted

技术标签:

【中文标题】如何在sharepoint上签入文件?【英文标题】:How to check-in a file on sharepoint? 【发布时间】:2019-01-07 10:40:45 【问题描述】:

我已经编写了以下代码,用于通过 Sharepoint 上的 VBA 签入文件。

Dim strWkbCheckIn As String

strWkbCheckIn = spBASE_URL + spDOC_LIB + "/" + spFILE_NAME

' Determine if workbook can be checked in.
If Workbooks(strWkbCheckIn).CanCheckIn = True Then
   Workbooks(strWkbCheckIn).CheckIn
   MsgBox ("checked in.")
Else
   MsgBox ("This file cannot be checked in ")
End If

但它显示以下错误:

Run-time error '9':
Subscript out of range

我已经检查过共享点上确实存在该文件。但仍然收到此错误。只是一个疯狂的猜测,有没有可能,因为文件和检出给我,它对程序不可见?

【问题讨论】:

【参考方案1】:

这应该为你做。

Sub testing()
    Dim docCheckOut As String
    'docCheckOut = "//office.bt.com/sites/Training/Design Admin/Training Plan/adamsmacro.xlsm"
    docCheckOut = "http://excel-pc:43231/Shared Documents/ExcelList.xlsb"
    Call UseCheckOut(docCheckOut)
    Call UseCheckIn(docCheckIn)
End Sub

Sub UseCheckOut(docCheckOut As String)
     ' Determine if workbook can be checked out.
    If Workbooks.CanCheckOut(docCheckOut) = True Then
        Workbooks.CheckOut docCheckOut
    Else
        MsgBox "Unable to check out this document at this time."
    End If
End Sub

Sub UseCheckIn(docCheckIn As String)
     ' Determine if workbook can be checked out.
    If Workbooks.CanCheckIn(docCheckIn) = True Then
        Workbooks.CheckIn docCheckIn
    Else
        MsgBox "Unable to check in this document at this time."
    End If
End Sub

【讨论】:

这个工作需要哪些参考资料? CanCheckIn 通常不是工作簿方法....

以上是关于如何在sharepoint上签入文件?的主要内容,如果未能解决你的问题,请参考以下文章

如何检索分支上元素的结帐评论?

SharePoint:如何批量签入(Check in)文档?

如何通过提交消息搜索 Git 存储库?

从 SP 2010 文档库中获取文档的最新签入版本(文档)

在 TFS 中配置通知电子邮件

Sharepoint练习——客户端对象模型