Disable Sharepoint 2010 Event Handler

I have two different event handler solutions in a list. One event handler runs on multiple lists if an Item is being Updated. Lets call that event handler (A). I have another event handler that runs on only one list. Lets call that event handler (B). Both
the event handlers (A) and (B) runs on the list that I am talking about. When an item is being updated, I have some scenarios when I want to disable event handler (B) but not (A). Event Handler (A) should run as usual. How do I disable just one event Handler?
I am using the code below to disable and enable the event handlers. This is disabling both the event handlers.
EventFiring eventFiring = new EventFiring();
eventFiring.DisableHandleEventFiring();
....some code
eventFiring.EnableHandleEventFiring();

Hi,
According to your description, you may want to manage the execution of the two Event Receivers for a specific list.
As a common practice, it is not recommended to control an Event Receiver from another Event Receiver, I would suggest you use the Event Receiver (A) only to capture the ItemUpdated event.
Since you might have different logic in the two Event Receivers, a possible workaround I can provide is that you can execute the two different logic accordingly by checking the name of the list which the item event occurs in, usually, an if…else… block would
do the trick.
Best regards
Dennis Guo
TechNet Community Support

Similar Messages

  • How can i disable Sharepoint 2010 xlviewer link

    Hi,
    I Prepare a report in excel 2010 file and uploaded in the Sharepoint 2010. And i see the report in the xlviewer.
    In the Viewer window top i see the link like this
    ServerName >FolderName > ReportName.xlsx
    How can i disable this link.

    Hi,
    If you want hide the breadcrumb in the xlviewer.aspx page, you can edit the xlviewer.aspx page in
    \14\TEMPLATE\LAYOUTS(backup the page before editing):
    Open the page using SharePoint Designer, under <asp:Content ContentPlaceHolderId="PlaceHolderPageTitleInTitleArea" id="m_TitleContent"
    runat="server">, add the following css code:
    <style type=”text/css”>
    .s4-mini-header
    { display:none; }
    </style>
    Xue-Mei Chang

  • All the Event receivers getting fired in SharePoint 2010 Event receiver Solution

    Hi friend.
    I have two event receivers. both are deployed as Farm Solution with Site as scope.
    ER1=> This event receiver is attached to Form Library and I have changed it's URL in Element.xml ListUrl as Listurl="TimeLog/Forms"
    ER2=> This event receiver is attached to Custom list and I have changed its Url in Element.xml as ListUrl="Lists/MyList"
    Both the Event receiver have ItemUpdated Event
    Here TimeLog is name of Form Library where I log time and MyList is name of custom list.
    Event Receivers are deployed to my Root site but I have page to redirect to other site collection which are under root site which contains my list and library. (Note: I dont have any list and library on my root site)
    Http://myportal/
    and I have other site collections
    http://myportal/sites/A
    http://myportal/Sites/B and so on..
    When I activate both the Event Receiver feature in SiteCollection "A" and updates some value in myList both the event receiver get fired and logs are generate.
    Can some one help me out to get only relevant event receiver get fired.  
    Thanks & Regards
    Gireesh Painuly

    Thanks all for your response.
    I identified the problem but did not find any solution. I would like to elaborate my requirement in detail:
    1- My Site collection structure is as below
    a. http://SP13/  => my root site as team site
    b. http://SP13/Sites/Client1
    c. http://SP13/Sites/Client 2    ..... and so on.. with same URL pattern.  
    1- I have created a SharePoint 2014 Empty SharePoint solution as Farm solution ( Because I have multiple site collection in a web application which perform same operation but belong to different clients)
    2- I added two Event Receivers in in this solution name ER1 and ER2
    3- I created two features ER1-Feature and ER2-Feature these feature contain related ER1(ER1-Feature) and ER2(ER2-Feature) i.e one feature contains ER1 and another feature contains ER2. Both of these features have scope=Site because I don't have any list
    and library at Root site that's why scope has not set to Web level.
    4. I created two list ERList1 and ERList2 for respected ER's i.e ERList1 for ER1 and ERList2 for ER2
    5. Both ER1 and ER2 has two methods ie. Item was Added and Item was Updated. I have just written code in these methods to create a text file to check which event receiver get called. I am not updating any list or library in these event.
    6. While creating Event Receiver I have selected Custom List as the source for triggering Event. but I modified Element.xml file of both the Receiver as below:
       A. ListUrl="Lists/ERList1" => in ER1 for ERList1 List
       B. ListUrl="Lists/ERList1" => in ER2 for ERList2 List.
    7. I Deployed my Solution to my root site ie Http://SP13/
    8. Now when I go to http://SP13/Sites/Client1 and open the ErList1. after adding a record in this list.. I get two log files generated in my drive that is ER1Executed.txt and ER2Executed.txt ( These files are generated by code which I have written in my
    ItemAdded and ItemUpdated methods of both ER1 and ER2 respectively
    9. Same two files are generate if i add any itme in ERList2 as well.
    10. But I identified it by creating both of these list at my root site to check whether tow file get created or not. but here it works fine just creates respected file. it means on related event receiver get fir as it should.
    So conclusion: 
    when Event receiver is activated in http://SP13/Sites/Client1 it creates two files mens ER is not able to find the list url properly. because in child site collection url get changed
    http://SP13/sites/client1/Lists/Erlist1
    How can I fix the URL in Element.xml so that related Event Receiver gets fired. I have multipla project in same Url pattern so that solution is deployed as Farm.
    Thanks 
    Gireesh Painuly

  • Can  DISABLE preProcess Event Handler add to the Orchestration parameters?

    I have a DISABLE pre-process event handler defined on the User object. I need to set the current date on a USR UDF attribute whenever the user is disabled or enabled or created. The CREATE handler works and the date value shows up on the user profile. However, when I try to set this attribute on the pre-process DISABLE or ENABLE event handlers, the new date does not show up. Here is the code I am using in my DISABLE/ENABLE event handler:
    Date currentTime = new Date(System.currentTimeMillis());
    orchestration.addParameter(USER_STATUS_DATETIME_ATTR_NAME, currentTime);
    Where the orchestration object is from the execute() parameter list.
    Any ideas as to why this is not working? Is adding to the orchestration not allowed for DISABLE or ENABLE event handlers? I know my handler is getting calls as I am logging the orchestration.getOperation() value.
    Thanks for any suggestions.
    -Dave
    Edited by: user552098 on Nov 12, 2012 1:56 PM

    When you update the field, make sure you are using the field label name, and not the UDF value.
    -Kevin

  • Disable SharePoint Mobile Browser Redirect

    I am trying to disable the Mobile Browser Redirect.  My goal is that even on a mobile device, our users will see the full SharePoint Portal. 
    I have edited Compact.browser and set all ”isMobileDevice" to False, however I am still being re-directed to the mobile site.
    Is there another step that I am missing.
    Any help is appreciated.
    Maggie

    Hi Maggie, did you check out this link?
    https://social.msdn.microsoft.com/Forums/sharepoint/en-US/2c2d4216-2e96-4dca-8772-5b291d42c545/disable-sharepoint-2010-redirect-to-mobile?forum=sharepointgeneralprevious
    cameron rautmann

  • EmailRecieved Event handler for incoming email in Sharepoint 2013

    Hi,
    I am developing custom event handler to enable incoming email for custom document library.  i have couple of questions.
    1. Once i attached the event handler, i could see incoming email settings for the custom document library, but it displays only 2 options as below :
                  1.   Allow this document library to recieve email
                                 Yes       No
                    2. E-mail address
    All other properties are not displaying. Is this normal behaviour on custom event handler for custom document library or any issue anywhere?
    2. So i have given other properties using powershell as below:
    $list = $web.lists["invoice Documents"]
    $list.EmailAlias ="TestDocument"
    $list.EnableAssignToEmail = $true
    $list.rootFolder.Properties["vti_emailusesecurity"] = 1
    $list.rootFolder.Properties["vti_emailsaveattachments"] = 1
    $list.rootFolder.Properties["vti_emailattachmentfolders"] = "root"
    $list.rootFolder.Properties["vti_emailoverwrite"] = 0
    $list.rootFolder.Properties["vti_emailsavemeetings"] = 0
    $list.rootFolder.Properties["vti_emailsaveoriginal"] = 0
    $List.RootFolder.Update();
    $list.Update();
    here i have given vti_emailusesecurity as 1, so it should allow incoming email for the user who has permission for the list.
    But any user from the domain is sending mail to this list, the Emailrecieved event handler is triggered. I am expecting that this event handler should not be triggered and expecting access denied error in the ULS Log. But that is not happening, and emailrecived
    is triggered and email is delivering to this address successfully.
    Can you please anyone help if experience on this?
    Thanks
    Sathya

    http://www.coretekservices.com/2012/01/26/sharepoint-content-organizer-%25e2%2580%2593-emailing-your-drop-off-library-and-getting-it-to-work
    Central Administration > Monitoring > Review Job Definitions (under Timer Jobs) > Content Organizer Processing
    Also check below:
    http://tutorial.programming4.us/windows_server/SharePoint-2010---Content-Organizer-as-a-Document-Routing-Tool.aspx
    If this helped you resolve your issue, please mark it Answered

  • Enable or disable button on a ribbon based on user permissions in SharePoint 2010

    Hi,
    I have requirement to find a way to disable Inheritance, Add and Modify group from permission tab for users who are not added into specific group e.g. Administrators
    I have followed the following article to create a feature but have encountered few issues:
    http://msdn.microsoft.com/en-us/library/ff408060.aspx
    Issues:
    I used the above code as a sample to create a feature and test if it would work. It worked fine but even though i have replaced Location="Ribbon.Library.Actions.ConnectToClient" with my permission locations,
    Connect to Outlook button still doesn't appear when the feature is activated. If i deactive this feature it shows
    Connect to Outlook button even though there is no reference for this in the code!
    I have modified the Elements.XML and have added the following code but it still disables the buttons for a user who has Site Collection Administrator permissions, i just want to disable this for users who are in particular group:
    <?xml version="1.0" encoding="utf-8"?>
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
    <CustomAction
    Id="RemoveRibbonButton"
    Location="CommandUI.Ribbon"
    RequireSiteAdministrator = "TRUE"
    >
    <CommandUIExtension>
    <CommandUIDefinitions>
    <CommandUIDefinition
    Location="Ribbon.Permission.Modify" />
    </CommandUIDefinitions>
    </CommandUIExtension>
    </CustomAction>
    <CustomAction
    Id="RemoveRibbonButton"
    Location="CommandUI.Ribbon"
    RequireSiteAdministrator = "TRUE"
    >
    <CommandUIExtension>
    <CommandUIDefinitions>
    <CommandUIDefinition
    Location="Ribbon.Permission.Add" />
    </CommandUIDefinitions>
    </CommandUIExtension>
    </CustomAction>
    </Elements>
    I have also have another issue when this feature is activated even though i haven't removed 'Check' and 'Manage' Ribbon locations, they are also greyed out as shown it the screenshot below:
    I have also created a user control using the following method:
    http://sharepointroot.com/2010/06/18/remove-actions-from-the-ribbon-sharepoint-2010/
    But again i need to restrict it specific user group.
    Any advice how to do this? or which way is better creating a feature or creating a user control? even though i liked the creating the feature as it gives your more control.
    Regards,
    Kashif

    Thanks for your reply Paul.
    I do understand that this is a partial solution and wouldn't stop them completely from doing these actions using different UI but atleast it would remove these options from the ribbon which is causing us some major issues when clicked by mistake especially
    'inherit permissions'.
    We do have governance policies in place and a certain user group can add and remove users from SP site. But the issue we have currently is that when one of these (authorised) users uses 'inherit permissions from parent' site. This removes the unique
    permissions from the subsite and delete all SP groups / permission level in the subsite. In some cases subsite contains confidential information which is then exposed to all the users who have access to the parent site.
    The main button which i'm interested to disable is 'Inherit Permissions' which i believe can't be used from anyother UI apart from the ribbon.
    I just need to know if it's possible to restrict this for some users or group? even if it just removes it from the ribbon only i would be still interested to explore this implementation.
    Any help would be apperciated.
    Regards,
    Kashif

  • Sharepoint 2010 foundation list open(export) to Access button disable?

    1. Why In sharepoint 2010 foundation list "Open with Access" button is disabled?
    2. Some PCs don't even able to see the "Open with Access" button in datasheet view?

    It is a external list
    Please firstly make sure you have installed Assess 2010 properly.
    And please check if the issue occured in all lists or just one list.
    Click File menu after you open the Access, you will see Open. There will open a windows, in the file type dropdownlist(the default value is "All Files(*.*)"), you can select "Microsoft SharePoint Foundation"
    http://community.office365.com/en-us/f/154/t/201186.aspx
    . Check if the add-on has been enabled by clicking
    Internet Options of IE, then selecting Programs > Manage add-ons. Here’s the screenshot for your reference.
    http://answers.flyppdevportal.com/categories/sharepoint2010/sharepoint2010general.aspx?ID=9afe0617-3dc0-49d2-919f-659bf80fde38
    The problem stems from having done a custom installation of Office Professional Plus 2010 and only installing Access.
    If you are doing a custom installation, you must expand Office Tools and Microsoft SharePoint Foundation Support. Under Microsoft SharePoint Foundation Support, there is another Microsoft SharePoint Foundation Support. Set this to Run from My Computer,
    and the Open with Access button will work.
    If this helped you resolve your issue, please mark it Answered

  • Conflict between Client object model and Item Updated Event Receiver in sharepoint 2010

    Hello All,
    As per my requirement I have a two custom list.
    Agent Details
    Port Name
    Agent Details contains Agent code, Port Name,  email, address and phone of Agent. Its possible that one Agent Code is connected with multiple Port Name.
    Basically what I am doing is I am getting port name connected with Agent code, using jquery and bind those values with check box(using javascript created dynamically) and bind all with Div tag.
    Now when my custom edit form of Agent list open up it shows me different port name binding with checkbox group.
    when user select the check box and click confirm button my clicent object model script will run and add this selected value into Port Name list. 
    After confirm one more button named Save will enable asking user to edit the email, phone or address value and when I click on save my Item updated event fires which update the values of the selected port name(These port name I am getting from port
    name list) to Agent Details custom list.
    Now when I am trying to update the values my event receiver fires or some times it got stuck(not firing). So could you please help me the possible alternative for this requirements.
    Can we user the Ecma Script(Client object model to preserve the value of selectec port) and Item updated event receiver on the same time?
    Is anything am doing wrong then please guide me.

    Hi,
    As I understand, when you updated values in the agent details list the Item updated event receiver got stuck sometimes.
    The item update event receiver will fire after the item has been saved, and the client object model script or the Ecma Script runs before the item is saved, so there is no conflict between the client object model script and item update event receiver.
    You could find out the reason about the item update event receiver gets stuck by debugging the event receiver.
    When you want to debug your event receivers, you have to attach to OWSTIMER.EXE and wait till they are executed. You can control this behavior using the Synchronization attribute. Also, if you’re looking for an easy way to debug an event receiver without
    having to manually attach a debugger to your code, you can use the System.Diagnostics.Debugger.Launch() method.
    The articles below are about how to debug in the event receiver in SharePoint 2010.
    http://sharepoint-kings.blogspot.jp/2013/02/debugging-event-receivers-in-sharepoint.html
    http://chakkaradeep.com/index.php/event-receivers-in-sharepoint-2010/
    http://sharesaint.com/?p=77
    Best regards,
    Sara Fan
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • User profile sync Sharepoint 2010 photos thumbnail with AD and Lync 2010 - error on Full Synchronization- get events 8311, 6110, 6803 FIMSynchronization Service

    User profile sync Sharepoint 2010 photos thumbnail with AD and Lync 2010 - error on Full Synchronization- get events 8311, 6110, 6803 FIMSynchronization Service
    We're trying to set up sync between Sharepoint and AD so photos are displayed in Lync.
    The certificate referenced in 8311 is not the sharepoint root cert, its the UCC cert with our FQDN of the site. sharepoint.domain.com
    Is this causing the problem with the sync and holding up the photos?
    I have tried several proposed fixes, it hasn't helped.
    tried this as well:
    http://blogs.technet.com/b/praveenh/archive/2011/05/11/event-id-8311-certificate-validation-errors-in-mss-2010.aspx
    Josh

    Try this fix and see if its sync the photos:
    http://blogs.technet.com/b/steve_chen/archive/2010/09/20/user-profile-sync-sharepoint-2010.aspx#Profile Picture Property
    http://blogs.technet.com/b/steve_chen/archive/2010/09/20/user-profile-sync-sharepoint-2010.aspx#SyncPicAD2SPS
    Update-SPProfilePhotoStore -CreateThumbnailsForImportedPhotos 1 -MySiteHostLocation <mySiteHostURL>
    Please remember to mark your question as answered &Vote helpful,if this solves/helps your problem. ****************************************************************************************** Thanks -WS MCITP(SharePoint 2010, 2013) Blog: http://wscheema.com/blog

  • How to create a recurring event in SharePoint 2010

    Hi there,
    I want to know how to create a recurring event that is 2 weeks long and start Monday. I want this event to recur every 4 weeks. I'm trying to create a schedule for two guys who work in the field.
    One guy works for 2 weeks in every 4 weeks starting on Monday.
    Thanks a million.
    Joe

    http://office.microsoft.com/en-in/sharepoint-server-help/sharepoint-calendars-i-make-the-most-of-your-team-calendar-RZ010255072.aspx?section=5
    You'll add items one at a time by clicking New Item on the
    New menu. Then you'll enter the item's details in a form. One other thing we should mention: It's easy to create recurring items, such as a weekly staff meeting. You do this by selecting the
    Make this a repeating event check box and then setting the item's recurrence pattern (for example, for a weekly lunch meeting you would set the pattern to weekly).
    http://social.technet.microsoft.com/Forums/sharepoint/en-US/e3b81c14-3217-4450-89ea-627620c126c2/recurring-events-in-calendar-view-of-sharepoint-2010-lists
    The Recurrence Data field is unique to the Event Content Type. I don't see any way to add it to an existing list. You would need to recreate your list using Calendar list as the base if you were to use this approach.
    http://blogs.technet.com/b/sharepointdevelopersupport/archive/2013/04/11/how-to-make-the-sharepoint-calendar-events-recurring-by-default.aspx

  • Getting Error In Item Added Event In Event Receiver in SharePoint 2010

    Hi Guys,
    I have written Event Receiver in SharePoint 2010 On ItemAdded event of Document Library. Wants to increment a col value by reading maximum value first. I wrote below code but sometime it works correctly but some time I got below error: Document Set
    enabled on this document library and weh we added any document in any document set then this event occurred. I mentioned Code block and Error description both.
    Please see and suggest right solution.
    Code:
    public override void ItemAdded(SPItemEventProperties properties)
                    base.ItemAdded(properties);
                    SPListItem _currentItem = properties.ListItem;
                    string _QUERY = @"<Where><Eq><FieldRef Name='DocumentId'/><Value Type='Text'>21</Value></Eq></Where><OrderBy><FieldRef
    Name='RevisionReference' Ascending='False' /></OrderBy><ViewFields><FieldRef Name='RevisionReference' /></ViewFields><QueryOptions><Folder>DocumentLIBB/</Folder></QueryOptions>";
                    int maxID = 0;
                    string revisionreferencee = string.Empty;
                    using (SPWeb web = properties.OpenWeb())
                        SPList list = web.Lists["DocumentLIBB"];
                        SPQuery query = new SPQuery();
                        query.ViewAttributes = "Scope=\"Recursive\"";
                        query.Query = (_QUERY);
                        SPListItemCollection results = list.GetItems(query);
                     if (results.Count > 0)
                            SPListItem item = results[0];
                            revisionreferencee = item["RevisionReference"].ToString();
                            bool result = Int32.TryParse(revisionreferencee, out maxID);
                            _currentItem["RevisionReference"] = maxID + 1;
                            _currentItem["DocumentId"] = item["DocumentId"].ToString();
                    properties.ListItem.File.Update();
                    _currentItem.Update();
    Error Desc:
    <nativehr>0x81020015</nativehr><nativestack></nativestack>The file EKENg LIBB/QA_DOC_044/05-22 Emirates Engineering Occurrence_Error Investigation - MEDA Process - 27 AUG 2009-921.doc has been modified by SHAREPOINT\system
    on 27 Aug 2012 12:10:13 +0400.
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
    Exception Details: System.Runtime.InteropServices.COMException: <nativehr>0x81020015</nativehr><nativestack></nativestack>The file EKENg LIBB/QA_DOC_044/05-22 Emirates Engineering Occurrence_Error Investigation - MEDA
    Process - 27 AUG 2009-921.doc has been modified by SHAREPOINT\system on 27 Aug 2012 12:10:13 +0400.
    Source Error:
    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. 

    Making the event synchronous (rather than the default) eliminates this error. If such a change suits your requirements you should consider it. You just have to tweak the elements.xml in your feature receiver project;
    http://blogs.msdn.com/b/unsharepoint/archive/2010/11/10/sharepoint-event-receivers-making-asynchronous-event-synchronous-to-avoid-save-conflict-error.aspx
    w: http://www.the-north.com/sharepoint | t: @JMcAllisterCH | c: http://www.b-i.com

  • Setting Item level access rights on sharepoint list item in ItemAdding event handler

    Hi ,
    I am using sharepoint 2013. I am trying to set item level access rights when a list item is added using the following code snippet,
    public override void ItemAdding(SPItemEventProperties properties)
    base.ItemAdding(properties);
    ConfigureItemSecurity(properties);
    private void ConfigureItemSecurity(SPItemEventProperties properties)
    var item=properties.ListItem;
    SPSecurity.RunWithElevatedPrivileges(delegate()
    using (SPSite site = new SPSite(properties.SiteId))
    using (SPWeb oWeb = site.OpenWeb())
    item.ParentList.BreakRoleInheritance(true);
    oWeb.AllowUnsafeUpdates = true;
    var guestRole = oWeb.RoleDefinitions.GetByType(SPRoleType.Reader);
    var editRole = oWeb.RoleDefinitions.GetByType(SPRoleType.Editor);
    SPGroup HRGroup = oWeb.SiteGroups.Cast<SPGroup>().AsQueryable().FirstOrDefault(g => g.LoginName=="HR Team");
    SPRoleAssignment groupRoleAssignment = new SPRoleAssignment(HRGroup);
    groupRoleAssignment.RoleDefinitionBindings.Add(guestRole);
    SPUserCollection users = oWeb.Users;
    SPFieldUserValueCollection hm = (SPFieldUserValueCollection)item["HiringManager"];
    SPFieldUserValueCollection pm = (SPFieldUserValueCollection)item["ProjectManager"];
    SPFieldUserValueCollection pmChiefs = (SPFieldUserValueCollection)item["ProjectManagerChief"];
    item.BreakRoleInheritance(true);
    item.RoleAssignments.Add(groupRoleAssignment);
    foreach (SPFieldUserValue staffMember in hm)
    SetRightsOnItem(item, staffMember, editRole);
    foreach (SPFieldUserValue staffMember in pm)
    SetRightsOnItem(item, staffMember, guestRole);
    foreach (SPFieldUserValue staffMember in pmChiefs)
    SetRightsOnItem(item, staffMember, guestRole);
    item.Update();
    private void SetRightsOnItem(SPListItem item, SPFieldUserValue staffMember, SPRoleDefinition role)
    SPUser employeeUser = staffMember.User;
    var userRoleAssignment = new SPRoleAssignment(employeeUser);
    userRoleAssignment.RoleDefinitionBindings.Add(role);
    item.RoleAssignments.Add(userRoleAssignment);
    Nothing is happening though... Is the event handler the right place to do this?
    thank you

    Hi ,
    You can refer to the code working in my environment:
    using System;
    using System.Security.Permissions;
    using Microsoft.SharePoint;
    using Microsoft.SharePoint.Utilities;
    using Microsoft.SharePoint.Workflow;
    namespace ItemLevelSecurity.ItemSecurity
    /// <summary>
    /// List Item Events
    /// </summary>
    public class ItemSecurity : SPItemEventReceiver
    /// <summary>
    /// An item was added.
    /// </summary>
    public override void ItemAdded(SPItemEventProperties properties)
    SPSecurity.RunWithElevatedPrivileges(delegate()
    try
    using (SPSite oSPSite = new SPSite(properties.SiteId))
    using (SPWeb oSPWeb = oSPSite.OpenWeb(properties.RelativeWebUrl))
    //get the list item that was created
    SPListItem item = oSPWeb.Lists[properties.ListId].GetItemById(properties.ListItem.ID);
    //get the author user who created the item
    SPFieldUserValue valAuthor = new SPFieldUserValue(properties.Web, item["Created By"].ToString());
    SPUser oAuthor = valAuthor.User;
    //assign read permission to item author
    AssignPermissionsToItem(item,oAuthor,SPRoleType.Reader);
    //update the item
    item.Update();
    base.ItemAdded(properties);
    catch (Exception ex)
    properties.ErrorMessage = ex.Message; properties.Status = SPEventReceiverStatus.CancelWithError;
    properties.Cancel = true;
    public static void AssignPermissionsToItem(SPListItem item, SPPrincipal obj, SPRoleType roleType)
    if (!item.HasUniqueRoleAssignments)
    item.BreakRoleInheritance(false, true);
    SPRoleAssignment roleAssignment = new SPRoleAssignment(obj);
    SPRoleDefinition roleDefinition = item.Web.RoleDefinitions.GetByType(roleType);
    roleAssignment.RoleDefinitionBindings.Add(roleDefinition);
    item.RoleAssignments.Add(roleAssignment);
    Thanks,
    Eric
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected].
    Eric Tao
    TechNet Community Support

  • Exchange Server 2010 public folder - Events show in SharePoint 2010 Calendar

    I want to fetch items to SharePoint 2010 Calendar from Exchange Server 2010 Public Folder Calendar called Event. How can I achieve this ?

    May be you can directly fetch whole public folder in sharepoint server
    http://www.amrein.com/apps/page.asp?Q=5778
    If this helped you resolve your issue, please mark it Answered

  • Issue with Copy of events from Outlook Calendar to SharePoint 2010 calendar(mapped in outlook)

    There is a issue while copying events in Outlook mapped SharePoint 2010 Calendar.
    This issue only seems to happen when user copies an event from his Outlook calendar to the SharePoint 2010 calendar. 
    He is able to create a new event in the SharePoint calendar from Outlook. 
    He tried below steps, but still no success
    1.
    Open your Outlook calendar.
    2. Open the event you want to copy.
    3. From the File menu, select Info.
    4. Click the Move to Folder button.
    5. In the Copy Items To dialog box, scroll down to the SharePoint Lists item and select the SharePoint calendar to which you want to copy the event.
    6. Click the OK button.
    7. Click the Yes button when prompted to continue. 
    Please let me know if there is any possible solution for it.

    Hi,
    I have done a test as your steps. I am able to copy an event from my Outlook calendar to the SharePoint 2010 calendar.
    1. I suggest you test in another compute, perhaps your Outlook results to that issue.
    2. Please create a new site collection, then test again, compare the result.
    3. Maybe it will take some time before the copied event displays in the SharePoint 2010 calendar. So, wait a minute, compare the result. 
    Best Regards,
    Wendy Li
    TechNet Community Support

Maybe you are looking for