Tag Info

New answers tagged

0

With thanks to Max Melcher, I found this workaround for creating Folders that writes AfterProperties to the item: $w = get-spweb http://redacted $list = $w.Lists["Shared Documents"] $f= $list.AddItem("", [Microsoft.SharePoint.SPFileSystemObjectType]::Folder, "test 2") $f.Update()


1

In code you can SPGroup spGroupItem = web.Groups["GroupName"]; SPRoleAssignment oRoleAssignment = web.RoleAssignments.GetAssignmentByPrincipal(spGroupItem); foreach (SPRoleDefinition inRole in oRoleAssignment.RoleDefinitionBindings) { //inRole.id //inRole.Name //1073741829 //limited access } Or you can find it using below function bool ...


0

Have you considered using the Content Organizer feature to route documents to the appropriate location instead of using custom code?


0

That's the solution : using (SPWeb web = properties.OpenWeb()) { bool oldUnsafeUpdates = web.AllowUnsafeUpdates; web.AllowUnsafeUpdates = true; SPList list = web.Lists.TryGetList("Pages"); SPListItem item = list.GetItemById(properties.ListItemId); ...


0

Using AfterProperties is generally not the approach I go with, since it's often buggy/not behaving the way we expect (see for instance Working with BeforeProperties and AfterProperties on SPItemEventReceiver). First thing, why do you use ItemAdding? In your case, wouldn't ItemAdded -in an asynchronous ER- be more suited? In an ItemAdded, I'd then have ...


0

As the processing of the after event also fires on a different thread it is also not possible to redirect to a different page from within the after event as neither the HttpContext object from the request initiating the original operation is available nor is it guaranteed that the after event is executed before the response of the original request has been ...


1

I don't think so. ItemUpdated is asynchronous, so by the time it fires, a response has already been sent back to the browser. If you do not have access to the HTTP Request and Response, you can't tell the browser to redirect.


0

Imho the page looks ugly, becouse detailed errors messages are enabled. Change web.config options back to turn it off, and it will show "standard" sharepoint error page with Your message. In my case if I want to display customized error message to user, I create Page and redirect to it from event receiver.


0

I played around with this for a few additional hours to try to see if there was some other property I could check on in the AfterProperties collection and there wasn't. However the properties object in the ItemUpdating method does have 2 other properties - BeforeUrl and AfterUrl which contain the old and the new value of Name (aka. FileLeafRef) By ...


0

How to rename Folder using SSOM public static class SPFolderExtensions { public static void RenameFolder(this SPFolder folder, string name) { folder.Item[SPBuiltInFieldId.FileLeafRef] = name; folder.Item.Update(); } } Usage: using (var site = new SPSite(siteUrl)) { using (var web = site.OpenWeb()) { var ...


0

Invalidates the current ListItem object.This method is used to invalidate an outdated SPListItem object. The invalidation of an SPListItem object triggers the retrieval of the updated object after the next request is made. A sample method is provided below public override void ItemAdding(SPItemEventProperties properties) { ...


1

So apparently, .Update() is called from within ApplyTheme(...) While that takes a couple seconds, any subsequent update will fail with the above error. To solve, simply set the master page first: foreach(SPWeb web in site.AllWebs) { web.MasterUrl = masterUrl; web.Update(); web.ApplyTheme(themeUrl, "", "", true); }


0

Is the url to dynamics ssl (https)? If so, make sure you have all of the certs in the certification path of the ssl certificate for the dynamics url loaded into the SharePoint trust center.



Top 50 recent answers are included