简体   繁体   English

使用 Syndication 从 SharePoint On Premise 获取数据

[英]Get Data from SharePoint On Premise by using Syndication

I had a question about how can we get the data from SharePoint on premise list and implement in Bot?我有一个问题,我们如何从 SharePoint 的前提列表中获取数据并在 Bot 中实施?

Any sample for this?有这方面的样品吗?

and I'm using C# to develop ChatBot.我正在使用 C# 来开发 ChatBot。

Here with the error for the ChatBot The element with name 'html' and namespace '' is not an allowed feed format.此处出现 ChatBot 错误名称为“html”和命名空间“”的元素不是允许的提要格式。

在此处输入图像描述

and here with my source code在这里我的源代码

  try
                {
XmlReaderSettings settings = new XmlReaderSettings();
            settings.DtdProcessing = DtdProcessing.Parse;
           settings.ValidationType = ValidationType.DTD;
          settings.MaxCharactersFromEntities = 1024;

            XmlUrlResolver resolver = new XmlUrlResolver();
            resolver.Credentials = new NetworkCredential("username", "Pa$$w0rd", "mvponduty.com");

            settings.XmlResolver = resolver;
                    string spurl = "https://mvponduty.sharepoint.com/sites/sg/daw/_layouts/15/srchrss.aspx?k=*%20ListId:7BC0F2C3-6366-48B8-B88A-8738BE1F9C31";
                    XmlReader reader = XmlReader.Create(spurl,settings);
                    SyndicationFeed feed = SyndicationFeed.Load(reader);

                    reader.Close();

                    var attachments = new List<Attachment>();
                    foreach (SyndicationItem item in feed.Items)
                    {
                        //Get Title,Description,URL
                        String title = item.Title.Text;
                        String description = item.Summary.Text;
                        String link = item.Links.FirstOrDefault().Uri.ToString();

                        //Hero Card
                        var heroCard = new HeroCard(
                            title: item.Title.Text,
                            subtitle: description,
                            buttons: new CardAction[]
                            {
                            new CardAction(ActionTypes.OpenUrl,"LINK",value:link)
                            }
                            ).ToAttachment();
                        attachments.Add(heroCard);

                    }
                    var reply = MessageFactory.Carousel(attachments);
                    await turnContext.SendActivityAsync(reply);
                }
                catch (Exception ex)
                {
                    await turnContext.SendActivityAsync(ex.Message.ToString());
                }

Thank you.谢谢你。

Using SharePoint search API we can get data from SharePoint for the given input in bot.使用 SharePoint 搜索 API 我们可以从 SharePoint 获取机器人中给定输入的数据。 Bot framework solution will be created in .net core. Bot 框架解决方案将在 .net 内核中创建。 so make sure your SharePoint calls are working fine.所以请确保您的 SharePoint 调用工作正常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM