html - VBA 到 Sharepoint 如何添加人员或组
问题描述
我目前正在使用一个 VBA 脚本,它接受 excel 输入并将它们上传到共享点。
我遇到的唯一问题是上传“人物”或“群组”,因为我得到类型不匹配,可能是因为它试图获取链接?
这是代码:
Sub AddItems()
'
' Requires a reference to "Microsoft ActiveX Data Object 6.0 Libray" to insert a record into a sharepoint list "AccessLog"
'
Dim cnt As ADODB.Connection
Dim rst As ADODB.Recordset
Dim mySQL As String
Set cnt = New ADODB.Connection
Set rst = New ADODB.Recordset
Dim LastRow As Long, i As Long
mySQL = "SELECT * FROM [TestingSharepoint];"
With cnt ' See https://www.connectionstrings.com/sharepoint/
.ConnectionString = _
"Provider=Microsoft.ACE.OLEDB.12.0;WSS;IMEX=0;RetrieveIds=Yes;DATABASE=https://share.amazon.com/sites/TestingIPVABO Sharepoint;List={F1BDB92A-349A-4056-9EF4-F6C5AFC3CE9F};"
.Open
End With
LastRow = Cells(Rows.Count, "A").End(xlUp).Row
rst.Open mySQL, cnt, adOpenDynamic, adLockOptimistic
Set ColumnToCheck = Worksheets("Audits_10d").Range("A1:A2000")
For Counter = 11 To LastRow
ValueToCheck = Sheets("Translation").Cells(Counter, 3).Value
If IsError(Application.Match(ValueToCheck, ColumnToCheck, 0)) Then
rst.AddNew
rst.Fields("Task ID") = Sheets("Translation").Cells(Counter, 3).Value
rst.Fields("Seller ID") = Sheets("Translation").Cells(Counter, 4).Value
rst.Fields("Site") = Sheets("Translation").Cells(Counter, 5).Value
rst.Fields("Mktpl") = Sheets("Translation").Cells(Counter, 6).Value
rst.Fields("Country") = Sheets("Translation").Cells(Counter, 7).Value
rst.Fields("Inv_Date") = Sheets("Translation").Cells(Counter, 8).Value
rst.Fields("Associate_Login") = Sheets("Translation").Cells(Counter, 9).Value
rst.Fields("Manager_Login") = Sheets("Translation").Cells(Counter, 10).Value
End If
Next Counter
rst.Update ' commit changes to SP list
If CBool(rst.State And adStateOpen) = True Then rst.Close
If CBool(cnt.State And adStateOpen) = True Then cnt.Close
End Sub
有人知道如何解决它吗?
解决方案
推荐阅读
- wordpress - Elementor 库:未连接(cURL 错误 28:连接超时 ...)
- android - android build.gradle 模块应用程序错误:无法解决:注释
- xaml - 如何仅在 UWP 中将 AcrylicBrush 添加到工具栏
- unix - CircleCI 运行多行命令
- parsing - 如何使用 asyncio 模块在 python 中解析网站?
- .net - 为什么我的 MessageBox 显示这么多次?
- java - PDFDomTree 在将 pdf 文件转换为 html 时未检测到空格
- android - 通过更新到 Android Studio 3.2 迁移到 AndroidX
- powershell - 删除文件和文件夹 1 级下
- ios - 没有为团队“xyz”找到具有 iTunes Connect 访问权限的帐户。App Store 分发需要itunes Connect 访问权限