Tag: sharepoint

提供的URI方案“https”无效; 调用Web服务时需要’http’

我试图使用自定义C#代码从CRM工作流调用SharePoint Web服务。 但是,当我运行我的代码时,我收到以下错误: The provided URI scheme ‘https’ is invalid; expected ‘http’. Parameter name: via 这是违规代码: #region Set up security binding and service endpoint BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.TransportCredentialOnly); binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Ntlm; binding.Security.Transport.ProxyCredentialType = HttpProxyCredentialType.Ntlm; EndpointAddress endpoint = new EndpointAddress(endpointAddress); #endregion #region Create the client and supply appropriate credentials CopySPContents.CopyService.SharepointFileServiceClient client = new CopySPContents.CopyService.SharepointFileServiceClient(binding, endpoint); […]

如何在defaultProxy配置设置中传递凭据?

客户端无法使用我的webpart,因为他位于代理服务器后面,他们需要指定用户名和密码才能通过代理。 我现在在配置文件中有这个: 有没有办法为这个代理设置提供用户名和密码?

从SharePoint 365下载文件

string remoteUri = “http://www.contoso.com/library/homepage/images/”; string fileName = “ms-banner.gif”, myStringWebResource = null; // Create a new WebClient instance. WebClient myWebClient = new WebClient(); // Concatenate the domain with the Web resource filename. myStringWebResource = remoteUri + fileName; Console.WriteLine(“Downloading File \”{0}\” from \”{1}\” …….\n\n”, fileName, myStringWebResource); // Download the Web resource and save it into the current […]

自动映射从XML创建对象

如果我有以下课程: class SPUser { public int ID { get; set; } public string Name { get; set; } public string LoginName { get; set; } public string Email { get; set; } public bool IsSiteAdmin { get; set; } public bool IsSiteAuditor { get; set; } public bool IsDomainGroup { get; set; } public List […]

在sharepoint中下载文件后不再回发

我试图从sharepoint下载文件。 但是在我下载这个文件后,我无法点击其他按钮。 我的编码出了什么问题? 这是我的第一种方式。 Response.AppendHeader(“content-disposition”, “attachment; filename= ” + fileName); Response.ContentType = “text/plain”; Response.WriteFile(Server.MapPath(“~/” + fileName)); Response.End(); 这是我的第二种方式 byte[] bytes = System.IO.File.ReadAllBytes(“D:\\” + fileName); Response.ClearContent(); Response.ClearHeaders(); Response.AddHeader(“Content-Type”, “application/octet-stream”); Response.AddHeader(“Content-Length”, bytes.Length.ToString()); Response.AddHeader(“content-disposition”, “attachment; filename= ” + fileName); Response.BinaryWrite(bytes); Response.Flush(); Response.End(); 我甚至评论Response.End()但仍然是相同的结果。 还有其他方法我应该尝试吗? 任何帮助将非常感激。 事实上,我几天前发布了这个问题,但只有一个人给了我第二种尝试方法,但它仍然没有用。 谢谢。 UPDATE 这是GridView下的GridView。 <asp:Label ID="lblValueDate" Text='’ runat=”server” /> <asp:HiddenField ID="hidCode" runat="server" Value='’ […]

如何修复错误:无法解析从服务器收到的消息

我们有一个使用AJAX的Sharepoint解决方案。 触发此按钮的按钮位于更新面板中。 我们所做的一件事就是生成一个MS Word文档,然后在客户端上打开它以便打印它。 将文档发送到客户端的代码如下所示: void OpenFileInWord(byte[] data) { Response.Clear(); Response.AddHeader(“Content-Type”, “application/msword”); Response.BinaryWrite(data); Response.Flush(); Response.End(); } 我们得到的错误是: Message: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled. Details: Error parsing […]

如何在.net中检测页面刷新

我有一个Button_click事件。 在刷新页面时,先前的Postback事件再次触发。 如何识别页面刷新事件以防止Postback操作? 我尝试了下面的代码来解决它。 实际上,我在SharePoint页面中添加了一个可视webpart。 添加webpart是一个post back事件所以!每次我将webpart添加到页面时,postback总是为false,并且我在else循环中收到错误,因为对象引用为null 。 if (!IsPostBack){ ViewState[“postids”] = System.Guid.NewGuid().ToString(); Cache[“postid”] = ViewState[“postids”].ToString(); } else{ if (ViewState[“postids”].ToString() != Cache[“postid”].ToString()){ IsPageRefresh = true; } Cache[“postid”] = System.Guid.NewGuid().ToString(); ViewState[“postids”] = Cache[“postid”].ToString(); } 我该如何解决这个问题?

如何引用两个版本的API?

我需要引用两个不同版本的Sharepoint API dll。 我有一个需要在Sharepoint 2和Sharepoint 3下运行的web服务,但还需要使用Sharepoint 3 API提供的新function(Checkout和内容审批) 实现这一目标的最佳方法是什么 – 我目前倾向于有两个项目,两个项目之间的代码在单个文件中共享,并使用条件编译编译代码的各个部分。 有没有更好的办法 ? 谢谢 马特

更新Sharepoint列表项

我收到了以下错误… System.NullReferenceException:未将对象引用设置为对象的实例。 在Program.cs中的ConsoleApplication1.Program.Main(String [] args)的Microsoft.SharePoint.SPListItem.get_UniqueId()处:第21行 运行以下代码 using (SPSite site = new SPSite(“http://site/”)) { using (SPWeb web = site.OpenWeb()) { try { SPList list = web.Lists[“ListName”]; // 2 SPListItem item = list.Items.Add(); Guid itemId = item.UniqueId; SPListItem itemUpdate = web.Lists[“ListName”].Items[itemId]; itemUpdate[“PercentComplete”] = .45; // 45% itemUpdate.Update(); } catch (Exception e) { Console.WriteLine(e); Console.ReadLine(); } } } […]

将列表项从一个列表复制到sharepoint中的另一个列表

在Sharepoint中如何将列表项从一个列表复制到另一个列表,例如从“列表A”复制到“列表B”(两者都在站点的根目录下) 我希望在将新列表项添加到“列表A”时进行此复制 我尝试在ItemAdded事件接收器中使用SPListItem的CopyTo()方法,但无法找出要复制到的url。