csom
25 TopicsCSOM : Server Unauthorized Access Exception: Access Denied.
i created window agent for the end user. where the data will send to the Data list Sharepoint. The problem is, when i try to use to the window agent to the local company user account, it shown the problem that i state on the title. But when i try to use my local company user account, it succcessfully sent. My theory: you need to have permission at sharepoint site using your local account and also in window current user, you need to use the same account at the sharepoint. Means, your local user account in windows and sharepoint is needed to send to datalist, and you cannot use other window account to send to datalist. any solution of this ? string username = "USERNAME"; string password = "PASSWORD"; string domain = "DOMAIN; System.Net.NetworkCredential _myCredentials = new System.Net.NetworkCredential(username, password, domain); string siteUrl = "MYSITE"; ClientContext clientContext = new ClientContext(siteUrl); SP.List oList = clientContext.Web.Lists.GetByTitle("Test_List"); ListItemCreationInformation itemCreateInfo = new ListItemCreationInformation(); ListItem oListItem = oList.AddItem(itemCreateInfo); //CUSTODIAN DETAIL oListItem["Title"] = "Test"; oListItem.Update(); clientContext.ExecuteQuery(); Console.WriteLine("Send Sucessfully!"); Console.ReadLine();Solved30KViews0likes11CommentsThe property is missing a required prefix/suffix per your organization's Group naming requirements
Hello All, My Organization enabled 'Group naming policy' in Azure AD. Current Policy: <Group name>(<Company>) It works perfectly when I try to create new teams through Teams App but We are facing issue when I try to create a Teams through CSOM based provisioning jobs. We are appending the Company Name suffix to the group name like below Ex. TestTeam(CompanyName) But still it is throwing below error: Code: Request_BadRequest Message: The property is missing a required prefix/suffix per your organization's Group naming requirements. Details: Detail0: Code: MissingPrefixSuffix Target: displayName AdditionalData: suggestedPropertyValue : sid-12-18-2021(MyCompany)() Inner error: AdditionalData: date: 2020-12-18T06:08:56 request-id: 2d495a06-22d7-4d6b-a92a-1e1ad24e2193 client-request-id: 2d495a06-22d7-4d6b-a92a-1e1ad24e2193 ClientRequestId: 2d495a06-22d7-4d6b-a92a-1e1ad24e2193 Code snippet I am referring below: UnifiedGroupEntity unifiedGroupEntity = UnifiedGroupsUtility.CreateUnifiedGroup(unifiedGroupInformation.DisplayName, unifiedGroupInformation.Description, unifiedGroupInformation.MailNickname, accessToken, unifiedGroupInformation.Owners, null, true, true, 10, 500); Thanks. BR. Sid4.9KViews0likes2CommentsUpdating Editor field on SharePoint Online using the CSOM with App Only Auth
I have the following issue. I work with CSOM and I want to update the Author and Editor field on a List Item object. The actual problem is that the Editor is not updated and the value is set to the SharePoint App user. The problem occurs after using the App Only Authentication. The following method is used to update Author, Editor, Creation Date and Modified Date. List<SP.ListItemFormUpdateValue> values = new List<SP.ListItemFormUpdateValue>(); foreach (ItemProperty property in properties) { property.AddPropertyToUpdateList(ctx, item, info, values); } IList<SP.ListItemFormUpdateValue> results = item.ValidateUpdateListItem(values, true, string.Empty); ctx.ExecuteQuery(); info.Log("<--// Called \'ValidateUpdateListItem\'. //-->"); // check for API-failures. CheckErrors(results); Do you have any ideas why this is not working for Editor but for Author-it works? I also tried to use the Update method to edit the Author and Editor, but this is also not working for the Author field. User user = service.Ctx.Web.EnsureUser("email address removed for privacy reasons"); ctx.Load(user); ctx.ExecuteQuery(); FieldUserValue userValue = new FieldUserValue(); userValue.LookupId =user.Id; item["Editor"] = userValue; item["Author"] = userValue; item.Update(); ctx.ExecuteQuery();4.2KViews0likes3CommentsUsing App Password to login to SharePoint Online CSOM
Is it possible to use app passwords to login to SharePoint Online CSOM based scripts? We need to run scripts unattended and thus, using Pnp web login is not an option. Anyone know of workarounds to run CSOM scripts unattended. Our scripts need SharePoint administrator permissions as it uses user profile bulk update API.4.1KViews0likes1CommentJSOM/REST Set List Item Property Bag Value
Hi all! Is there a way to set List Item Property Bag value using JavaScript Object Model or REST API? I've tried to use the approach that works fine for Web and List (Root folder) property bags: var ctx = SP.ClientContext.get_current(); var web = ctx.get_web(); var list = web.get_lists().getByTitle('import test'); var item = list.getItemById(1); ctx.load(item); ctx.executeQueryAsync(function() { var props = item.get_properties(); props.set_item('test', 'test'); item.update(); ctx.executeQueryAsync(); }); But if you then refresh the page and get list item's properties again, the new key-value won't be there. There are no errors in the response of executeQueryAsync...3.4KViews0likes0CommentsAdd to PnP Provisioning template using CSOM
I am currently creating a console application using the PnP provisioning engine. I'd like to be able to add a list to the template in memory using CSOM as per https://github.com/SharePoint/PnP-Guidance/blob/master/articles/provisioning-console-application-sample.md template.Lists.Add(new ListInstance() { Title = "PnP Sample Contacts", Url = "lists/PnPContacts", TemplateType = (Int32)ListTemplateType.Contacts, EnableAttachments = true }); What I can't figure out is how to do the content type bindings.Solved3.1KViews1like5CommentsCSOM SystemUpdate() cannot update Editor field
In a SharePoint Online Document Library I've a file that is in published status (version x.0). I am updating various fields of this file with the listItem.SystemUpdate() command. I need this sort of update because is the only one that can be used on a published file that not increase the version. (UpdateOverrideVersion return an error on published documents) When I try to update the Editor fields this is not updated. (_currentItem is a File object) var user = _ctx.Web.EnsureUser(publishinfo.currentUser_email); _ctx.Load(user); _ctx.ExecuteQuery(); _currentItem.ListItemAllFields["Editor"] = user; _currentItem.ListItemAllFields.SystemUpdate(); _ctx.ExecuteQuery(); All other fields of the item can be updated. "Editor" and "Modified" are the only two that are not working. (Author for example is correctly updated in this way) Any idea? Thanks2.2KViews0likes1CommentIssue Setting Domains AllowList for Sharing in CSOM API
Hi all We found an issue trying to set allowed domains for sharing through CSOM. When setting the site property's SharingDomainRestrictionMode to AllowList and setting the SharingAllowedDomainList all queries are executed without error, however when looking at the sharing settings in SharePoint the "Limit external sharing by domain." checkbox is checked, but the mode is set to "Don't allow sharing with users from these blocked domains" and no domains are in the list. The BlockList SharingDomainRestrictionMode works, and the SharingBlockedDomainList can be set. SharingDomainRestrictionMode None also works, only the AllowList does not work as intended. Does anyone have any idea what's going on here? var siteProperties = tenant.GetSitePropertiesByUrl(siteCollectionUrl, false); ctx.Load(siteProperties, s => s.SharingDomainRestrictionMode, s => s.SharingAllowedDomainList); ctx.ExecuteQueryRetry(); siteProperties.SharingDomainRestrictionMode = SharingDomainRestrictionModes.AllowList; siteProperties.SharingAllowedDomainList = domainString; siteProperties.Update(); ctx.ExecuteQueryRetry();Solved2.2KViews0likes4CommentsHow to Restore Alerts for a Site collection? [SOS]
Hi there, We are using SharePoint Online. One of our site admins accidentally deleted all the alerts set up by different users on different libraries, folders and documents. We don't have any information on the deleted alerts or what type they were (immediate, weekly, daily etc). We really want all these alerts back. Is there any way that I could get these alerts back or at least the information about these alerts so that I can create the same alerts again? I can work with CSOM, PowerShell or anything that solves the problem. I just want these alerts back! if it is possible.2KViews1like3CommentsCSOM error WASSN_ACTUALS_PENDING IS NULL
I'm currently developing a Project Online client application using CSOM. When i'm requesting the Task Assignments i'm receiving the following error with some projects: The value for column 'WASSN_ACTUALS_PENDING' in table 'Assignments' is DBNull. I've already checked out and published the project but it doesn't help. Any suggestions how to solve this?1.9KViews0likes5Comments