Get User who created list item

  • Get User who created list item TheVillageIdiot

    In IAlertNotifyHandler implementation I need name of the user who created/add the current item/document to the list (for which this alert is being sent). What is the way to do this?

  • When you create your OnNotification method you can access the list item with code similar to this.

    public bool OnNotification(SPAlertHandlerParams ahp)
          SPSite site = new SPSite(ahp.siteUrl+ahp.webUrl);
          SPWeb web = site.OpenWeb();
          SPList list=web.Lists[ahp.a.ListID];
          SPListItem item = list.GetItemById(ahp.eventData[0].itemId);
          String user = item("Author");

    Not sure on your requirements but you may need to add some additional code to then get a domain\username if this is what you require.

    Note: This is sub-optimal code to highlight only the code needed to get the list item. I know there are dispose issues here.

alert 2007 email
Related questions and answers
  • the user who is creating (creator) and saving the InfoPath form. I've also created a secondary workflow to manage reminders and escalations. In this case, the creator needs to be part of the site collection owners group for the workflow to complete successfully. This poses a permission issue since I am setting item level permission and granting Read permission to the creator once the form is submitted for approval. But the workflow is progressing only if the creator is given Full Control for the Forms library as well as the list item. I've three levels of approval. Both the approvers

  • I have an initial workflow in Sharepoint Designer that triggers whenever an item is created and also whenever an item has changed in the 'Employee' list . Within second workflow I am updating the 'Employee' list and the workflow above is triggered. Is there any way I can check in the intial workflow if the item has been updated by a user or if it was updated by a workflow. In the case if the item was updated by a workflow I would not want to trgigger it. Many Thanks,

  • I developed a custom event receiver class that overrides the ItemAdded method after the list item is added I want to make some checks and based on a certain condition I want to delete the added item. I was able to delete the item but i want to display an error message so I used properties.Cancel = true; properties.ErrorMessage = "Can't insert this item"; when I debugged I found no errors but the user is not directed to the error page. is there any workaround for this ? thanks

  • I've created a custom list in SharePoint 2010 from a custom content type (inherit from item) and I would like to give the users the option to order the items in this list - similar to how users can order items in an out of the box Links list. In SharePoint 2007 I did this several times by using the OrderedList property in the List element of the schema.xml, and I've tried the same approach... that indicate that the list can be ordered by a user. However, I'm missing the button (Change Item Order) on the ribbon that allows a user to order the list. I can navigate to the /_layouts/reorder.aspx

  • to be the user who is getting blocked). I am stumped and would appreciate any help or suggestions. .... Note that this is just opening the Excel file without checking it out. Problem: Once in a while, and for no reason I can figure out, a user will click the button and the spreadsheet will be returned... is causing this behavior? I can change the code to avoid it if I can figure out why it is happening. Is there any way through the SharePoint UI or APIs to "release" the document so that the original

  • Within my workflow using SPD I am using the "Create New Item" action to create a new Task list item this is fired when a holidayrequest item is created. My problem is I cannot see how to create/store a link back to the orignial holiday request item that created the task, so I can display this in the Task's edit form.

  • I'm having this issue on several server environments. We have a list at the site collection root. There is a site column created as a multi-value lookup on that list's Title field. This site column is used in document libraries in subsites as a required field. When we upload anything but an Office 2007 document, the user is presented with the document metadata fill-in screen (EditForm.aspx... to the problem: CMS/Publishing/8ztg/Medium/Got List Item Version, but item was null

  • Within my workflow I am using the 'Collect Data from user'. I want to send a custom email (by turning of alerts on the Task list) and using the Send Email action. My problem is I want to send a link with the task to approve in an email to the user the task has been assigned to (approver). But the action ''Collect Data from user' pauses until the task is edited which won't happen because I haven't sent the details to the approver via an email! Is there any way to get around this? Or get a reference from a newly created task back to item that created it from the 'Collect Data from user

  • I have a need to calculate working days until an item is due or working days past due. I also have to exclude holidays and the holidays may or may not apply to that item based on what project the holiday applies to. I had created a holiday calendar and initially created the field as a computed field that would display an empty div tag and I would use code to do the calculations and display it inside the div tag using javascript. This worked fine when the items were in a single list. Due to other requirements I needed to create a single list for each department. Now I still need to display

Data information