本文介绍了在SQL数据库上插入新行时在SharePoint上创建项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好SharePointers,

Hello SharePointers, 

我有自定义应用程序,该应用程序在我们的Sql Server上添加了新问题.当通过自定义应用程序添加新问题时,我正在寻找一种将数据从SQL服务器获取到在线SharePoint列表的方法.

I have custom application which add the new issue on our Sql Server. I am looking for a way to get data from my SQL server to my online SharePoint List when new issue is added via custom application.

任何人都可以建议

谢谢

Kundan

推荐答案

您可以创建控制台应用程序并使用CSOM在线连接到SharePoint并进行数据处理同步,您甚至可以安排Windows Scheduler中的应用每天运行(基于 在您的设置上).

You may create a console app and use CSOM to connect to SharePoint online and do data synchronization, you could even schedule the app in windows scheduler to run daily(based on your settings).

此处是有关SharePoint Online中身份验证的示例代码.

using (var context = new ClientContext("https://xxx.sharepoint.com/sites/lee/"))
            {
                Console.ForegroundColor = ConsoleColor.Green;
                string password = "pw";
                SecureString sec_pass = new SecureString();
                Array.ForEach(password.ToArray(), sec_pass.AppendChar);
                sec_pass.MakeReadOnly();
                context.Credentials = new SharePointOnlineCredentials("user@xxx.onmicrosoft.com", sec_pass);
                
                var item = context.Web.Lists.GetByTitle("MyDoc2").GetItemById(7);
                context.Load(item);
                context.ExecuteQuery();                
                Console.WriteLine(item.FieldValues["Name"]);
                Console.ReadKey();
            }

您可以在下面的链接中查看有关CSOM CRUD操作的更多详细信息.

此处是有关Windows任务计划的链接,供您参考.

https://technet.microsoft.com/zh-CN/library/cc748993(v=ws.11).aspx

最好的问候,


这篇关于在SQL数据库上插入新行时在SharePoint上创建项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-31 15:39