我正在尝试将SharePoint任务列表的EnableAssignToEmail
属性设置为YES
,以便分配的用户在将任务分配给他/她后收到电子邮件。但我收到错误为An unhandled exception of type 'System.MissingMethodException' occurred in mscorlib.dll
**Additional information**: Method not found: 'Void
Microsoft.SharePoint.Client.List.set_EnableAssignToEmail(Boolean)".
我正在使用nuget
软件包中最新版本的CSOM DLL。
using (ClientContext obj = new ClientContext("SharePOint site url")) {
using (SecureString objSec = new SecureString())
{
foreach (var item in "PWD")
{
objSec.AppendChar(item);
}
obj.Credentials = new SharePointOnlineCredentials("USERNAME", objSec);
var list = obj.Web.Lists.GetByTitle("Action");
obj.Load(list);
//obj.Load(list.EnableAssignToEmail);
obj.ExecuteQuery();
list.EnableAssignToEmail = true;
obj.ExecuteQuery();
}
}
答案 0 :(得分:0)
再次加载列表对象并在更改EnableAssignToEmail属性后执行ExecuteQuery,如下所示:
string userName = "xxx@tenant.onmicrosoft.com";
Console.WriteLine("Enter your password.");
SecureString password = GetPassword();
using (var clientContext = new ClientContext("https://tenant.sharepoint.com/sites/sitename"))
{
// SharePoint Online Credentials
clientContext.Credentials = new SharePointOnlineCredentials(userName, password);
// Get the SharePoint web
Web web = clientContext.Web;
// Load the Web properties
clientContext.Load(web);
// Execute the query to the server.
clientContext.ExecuteQuery();
// Web properties - Display the Title and URL for the web
List list = web.Lists.GetByTitle("List1");
list.EnableAssignToEmail = true;
clientContext.Load(list);
clientContext.ExecuteQuery();
}