VBA将记录插入现有SharePoint联机列表 [英] VBA to insert record to an existing SharePoint online list

查看:121
本文介绍了VBA将记录插入现有SharePoint联机列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用在互联网上许多地方发布的代码片段,从VBA向现有的sharepoint在线共享点(O365)添加项目。这必须适用于该版本(SP 2010),但不适用于SP Online。我使用浏览器登录
到O365,我是管理员的列表。我得到响应代码200,但没有项目添加到列表中。

I am trying to add an item to an existing sharepoint online (O365) list from VBA using a code snippet that is published in many places on the internet. This must have worked for that version (SP 2010) but is not working against SP Online. I am logged on to O365 using a browser, I am admin for the list. I do get response code 200, but no item is added to the list.

应该更改哪些内容以便为项目添加新项目?有人可以帮帮我吗?

What should change so that items are added a new item? Can somebody help me?

推荐答案

请尝试在objXMLHTTP.Open方法中传递用户名和密码。

Please try to pass the username and password in the objXMLHTTP.Open method.

Dim CurUserName As String, CurPassword As String
CurUserName = "UserName"
CurPassword = "Password"
objXMLHTTP.Open "POST", SharepointUrl + "_vti_bin/Lists.asmx", False, CurUserName, CurPassword

http://depressedpress.com/2014/04/05/accessing-sharepoint-lists-with -visual-basic-for-applications /

或者必须使用Authorization标头发送用户名和密码。用户名和密码也应为base64编码。 示例:

Or a username and password have to be sent with the Authorization header. Username and password should also be base64 encoded.  Example :

user = "someusername"
password = "somepassword"
objXMLHTTP.setRequestHeader "Authorization", "Basic " + Base64Encode(user + ":" + password)

https://codingislove.com/http-requests-excel-vba/

最好的问候,

Dennis

Dennis


这篇关于VBA将记录插入现有SharePoint联机列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆