我正在尝试使用sharepoint webservice删除文档,如果有人上传文档然后点击取消.我创建了以下功能
function DeleteDocument(libraryName, ID)
{
debug.log('DeleteDocument (Entry) libraryname = '+libraryName+' ID='+ID);
var batch =
"<Batch OnError='Continue'> \
<Method ID='1' Cmd='Delete'> \
<Field Name='ID'>" + ID + "</Field> \
</Method> \
</Batch>";
var soapEnv =
"<?xml version='1.0' encoding='utf-8'?> \
<soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' \
xmlns:xsd='http://www.w3.org/2001/XMLSchema' \
xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'> \
<soap:Body> \
<UpdateListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'> \
<listName>"+libraryName+"</listName> \
<updates> \
" + batch + "</updates> \
</UpdateListItems> \
</soap:Body> \
</soap:Envelope>";
debug.log(soapEnv);
$.ajax({
url: "http://<serverandsite>/_vti_bin/lists.asmx",
beforeSend: function(xhr) {
xhr.setRequestHeader("SOAPAction",
"http://schemas.microsoft.com/sharepoint/soap/UpdateListItems");
},
type: "POST",
dataType: "xml", …Run Code Online (Sandbox Code Playgroud) 我正在构建一个每隔几分钟运行一次的工具,然后转到办公室365站点并检索并处理信息.
目前,我已经开始使用MSDN指南"使用基于声明的身份验证在SharePoint Online中进行远程身份验证",该指南指出了一个非常有用的代码示例,它根据用户登录获取clientcontext对象,然后提取cookie.
我希望能够在任务计划程序中运行我的代码,这样您就可以在某个配置中指定办公室用户名和密码.
有没有人有任何代码可以做到这一点或起点.就像是
using (ClientContext ctx = SomeClass.GetContext(targetSiteUrl, username, password))
{
if (ctx != null)
{
//dostuffhere
}
}
Run Code Online (Sandbox Code Playgroud)
我看过这篇博文使用声明身份验证自动登录SharePoint,但网站上的代码似乎不完整/我无法使其正常工作
请注意,我指的是Office 365的当前版本(基于2010年),而不是2013年新推出的beta版
sharepoint sharepoint-2010 sharepoint-object-model office365
我试图在事件接收器中设置ListItem上的字段的值,但它不起作用
我在活动期间所做的一切都是
properties.AfterProperties[<field internal name>] = 1;
Run Code Online (Sandbox Code Playgroud)
没有错误被抛出,但我设置的字段不会改变.我也试过了
properties.ListItem[<field internal name>] = 1;
properties.ListItem.Update();
Run Code Online (Sandbox Code Playgroud)
还试过SystemUpdate();
我知道我打算设置后续属性,但我认为我错过了一个明显的步骤.
谢谢