使用外部HTML页面中的WEB API获取/发布数据到共享点。 [英] Get/Post data to Share point using WEB API from External HTML Page.

查看:191
本文介绍了使用外部HTML页面中的WEB API获取/发布数据到共享点。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我想从外部系统将数据发布到SharePoint列表/库。 

I want to Post data to SharePoint List / Library from External System. 

当我是尝试使用REST我得到401未经授权的错误。

When I am Trying it with REST I am getting 401 unauthorized Error.

我想为此编写WEB API。请帮我一些代码示例或链接。

I want to write WEB API for the same. Please help me with some code sample or Links for it.

提前致谢。

 

amol

推荐答案

由于您未向SharePoint提供身份验证,因此您获得了401。

As you didn’t provide authentication to SharePoint, so you got 401.

您可以在外部系统中创建Web api主机,在Web api中,连接到SharePoint通过CSOM与服务器帐户。

You could create a web api host in your External System, in the web api, connect to SharePoint by CSOM with a server account.

在线程下共享一个很好的演示,您需要更新逻辑以使用服务器帐户凭据,因为您的外部系统似乎是不同网络中的主机。

Below thread shares a good demo, you need update below logic to use server account credential as your external system seems hosts in different networks.

//默认网络凭证只是AppPool帐户

//The default network credential is nothing but the AppPool Account

clientContext.Credentials = CredentialCache.DefaultNetworkCredentials;

clientContext.Credentials = CredentialCache.DefaultNetworkCredentials;

To

clientContext.Credentials = new NetworkCredential(" user"," password"," domain");

clientContext.Credentials = new NetworkCredential("user", "password", "domain");

<跨度> http://www.sharepointpals.com/post/Create-a-WebAPI-to-AddEditDelete-the-data-from-a-SharePoint-List

最好的问候,

Lee


这篇关于使用外部HTML页面中的WEB API获取/发布数据到共享点。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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