Disable event firing while updating list item in custom timer job

Hi
I am adding new items in the list usign custom timer job.
While adding the items in the list event receiver of another list (which is not related to list which is updating) is getiing fired due to which I am getting data wrongly updated and exceptions are comming.
why the another lists event recevier is executing while updating my list?
How can I disable event firing from timer job code?
please suggest any solution

Hello,
It seems you have deployed your event receiver globally and it is applied to all the lists. I can suggest two ways:
1. Either you update your event receiver feature.xml file and attached to specific list, wherever you want. You can follow below link to attach event with specific list via code:
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.speventreceiverdefinition.aspx
Or instead of code you can also pass ListUrl in feature.xml file:
http://msdn.microsoft.com/en-us/library/ff398052.aspx
2. OR delete event receiver from the list: You can use below code in your timer job to delete event receiver
http://sarangasl.blogspot.in/2009/11/remove-event-receiver-in-sharepoint.html
Hope it could help
Hemendra:Yesterday is just a memory,Tomorrow we may never see
Please remember to mark the replies as answers if they help and unmark them if they provide no help

Similar Messages

  • How to Disable Event firing while updating a list item using poweshell

    Hi All,
    I am working on a powershell code which updates most of the list items in the entire web application. I am using SystemUpdate($false) to update the items so that 'modified' and 'modified By' and versions are not changed.
    However event receivers gets fired which is now a problem. I want to disable the Event receivers before update and enable it after update. I want powershell code for this. I am using SharePoint 2010.
    Your help would be much appreciated. Thank you in anticipation.
    Regards
    Karthik R.

    hi
    check this thread:
    How to disable event firing outside an event. It contains example on C#, but it is not difficult to convert it to PowerShell.
    Blog - http://sadomovalex.blogspot.com
    Dynamic CAML queries via C# - http://camlex.codeplex.com

  • Fire event receiver after update list items with PowerShell

    Hi,
    I have a list with a event receiver attached to it. Also I have a PowerShell script which updates some elements. I noticed that the Event Receiver is not firing after the PowerShell script runs. Is there any way to make it happen?
    Thanks anyway!

    Hi,
    According to your description, my understanding is that the event receiver not fire after you update the item elements.
    I suggest you can create a simple event receiver and then test if the event receiver fire after PowerShell run.
    Here is my PowerShell script:
    $spWeb = Get-SPWeb -Identity http://sp2013sps/sites/test
    $spList = $spWeb.Lists["Documents"]
    $spItem = $spList.GetItemById(14)
    $spItem["Title"] = "Test111"
    $spItem.Update()
    Here is my event receiver code:
    public override void ItemUpdated(SPItemEventProperties properties)
    base.ItemUpdated(properties);
    Console.WriteLine("event receiver has been done");
    After the PowerShell run, it will come out the result:
    It means the event receiver has been fired.
    Here is a detailed article for your reference:
    http://blogs.technet.com/b/speschka/archive/2009/12/25/debugging-event-receivers-in-sharepoint-2010.aspx
    Thanks
    Best Regards
    Jerry Guo
    TechNet Community Support

  • How to update list item using client object model without changing created/modified dates?

    Hello All,
    I want to update list item using the SharePoint Client Object
    Model without updating the created / modified date. Is it possible?
    Please help.
    Thanks.

    Using the SystemUpdate method should do the trick, according
    to its literature.
    Additionally, would something like this be of any use for you?  Taken from this
    Stack Exchange thread: -
    public static class SPListItemExtensions
    /// <summary>
    /// Provides ability to update list item without firing event receiver.
    /// </summary>
    /// <param name="item"></param>
    /// <param name="doNotFireEvents">Disables firing event receiver while updating item.</param>
    public static void Update(this SPListItem item, bool doNotFireEvents)
    SPItemEventReceiverHandling rh = new SPItemEventReceiverHandling();
    if (doNotFireEvents)
    try
    rh.DisableEventFiring();
    item.Update();
    finally
    rh.EnableEventFiring();
    else
    item.Update();
    /// <summary>
    /// Provides ability to update list item without firing event receiver.
    /// </summary>
    /// <param name="item"></param>
    /// <param name="incrementListItemVersion"></param>
    /// <param name="doNotFireEvents">Disables firing event receiver while updating item.</param>
    public static void SystemUpdate(this SPListItem item, bool incrementListItemVersion, bool doNotFireEvents)
    SPItemEventReceiverHandling rh = new SPItemEventReceiverHandling();
    if (doNotFireEvents)
    try
    rh.DisableEventFiring();
    item.SystemUpdate(incrementListItemVersion);
    finally
    rh.EnableEventFiring();
    else
    item.SystemUpdate(incrementListItemVersion);
    /// <summary>
    /// Provides ability to update list item without firing event receiver.
    /// </summary>
    /// <param name="item"></param>
    /// <param name="doNotFireEvents">Disables firing event receiver while updating item.</param>
    public static void SystemUpdate(this SPListItem item, bool doNotFireEvents)
    SPItemEventReceiverHandling rh = new SPItemEventReceiverHandling();
    if (doNotFireEvents)
    try
    rh.DisableEventFiring();
    item.SystemUpdate();
    finally
    rh.EnableEventFiring();
    else
    item.SystemUpdate();
    private class SPItemEventReceiverHandling : SPItemEventReceiver
    public SPItemEventReceiverHandling() { }
    new public void DisableEventFiring()
    base.DisableEventFiring();
    new public void EnableEventFiring()
    base.EnableEventFiring();
    Steven Andrews
    SharePoint Business Analyst: LiveNation Entertainment
    Blog: baron72.wordpress.com
    Twitter: Follow @backpackerd00d
    My Wiki Articles:
    CodePlex Corner Series
    Please remember to mark your question as "answered" if this solves (or helps) your problem.

  • Collect data from User workflow error updating list item

    Hi, can someone please help me with WSS 3 workflows?!
    I'll keep it simple - I have a workflow step "Collect data from user" that will fail with Unknown Error when attempting to update list item (this is after the user has clicked Complete Task). The workflow does not continue past this step and I have
    to terminate the workflow.
    What is odd, is that if I do another Collect data from User in the same step but following the 1st collect, both will work!! How can this be?? This proves the 1st collect is OK so why won't it run without another Collect data after it?! Doesn't make sense to
    me.
    I was just trying the second Collect to troubleshoot the issue. I've tried other actions there but having another Collect does seem to be the action that kicks things into life. Is there a clue here?
    Any clues would be much appreciated as I'm not able to turn much up when I Google.
    Thanks

    Well, surprise, surprise, this has come back (thought it might!). The trace logs show it's a task locked error but I can't see how. Can anyone please provide me with some clues??
    03/14/2014 12:30:25.11     w3wp.exe (0x7698)                           0x5EA4    Windows SharePoint
    Services       Web Controls                      88wy    Medium      SPDataSourceView.ExecuteSelect()
    - selectArguments: IsEmpty=True, MaximumRows=0, RetrieveTotalRowCount=False, SortExpression=, StartRowIndex=0, TotalRowCount=-1    
    03/14/2014 12:30:28.39     w3wp.exe (0x7698)                           0x6C4C    Windows SharePoint Services 
         Web Controls                      88wy    Medium      SPDataSourceView.ExecuteSelect() - selectArguments:
    IsEmpty=True, MaximumRows=0, RetrieveTotalRowCount=False, SortExpression=, StartRowIndex=0, TotalRowCount=-1    
    03/14/2014 12:30:28.47     w3wp.exe (0x7698)                           0x6C4C    Windows SharePoint Services 
         Web Controls                      88wy    Medium      SPDataSourceView.ExecuteSelect() - selectArguments:
    IsEmpty=True, MaximumRows=0, RetrieveTotalRowCount=False, SortExpression=, StartRowIndex=0, TotalRowCount=-1    
    03/14/2014 12:30:29.86     w3wp.exe (0x7698)                           0x7A94    Windows SharePoint Services 
         Workflow Infrastructure           72er    Medium      Microsoft.SharePoint.SPException: This task is currently locked by a running workflow and cannot
    be edited.     at Microsoft.SharePoint.SPListItem.PrepareItemForUpdate(Guid newGuidOnAdd, SPWeb web, Boolean bMigration, Boolean& bAdd, Boolean& bPublish, Object& objAttachmentNames, Object& objAttachmentContents, Int32&
    parentFolderId)     at Microsoft.SharePoint.SPListItem.UpdateInternal(Boolean bSystem, Boolean bPreserveItemVersion, Guid newGuidOnAdd, Boolean bMigration, Boolean bPublish, Boolean bNoVersion, Boolean bCheckOut, Boolean bCheckin, Boolean
    suppressAfterEvents)     at Microsoft.SharePoint.SPListItem.Update()     at Microsoft.SharePoint.Workflow.SPWinOEWSSService.CommitUpdateListItem(Transaction txn, Object[] transData)    
    03/14/2014 12:30:29.86     w3wp.exe (0x7698)                           0x7A94    Windows SharePoint Services 
         Workflow Infrastructure           72fe    High        Error in commiting pending workflow batch items: Microsoft.SharePoint.SPException: This
    task is currently locked by a running workflow and cannot be edited.     at Microsoft.SharePoint.SPListItem.PrepareItemForUpdate(Guid newGuidOnAdd, SPWeb web, Boolean bMigration, Boolean& bAdd, Boolean& bPublish, Object& objAttachmentNames,
    Object& objAttachmentContents, Int32& parentFolderId)     at Microsoft.SharePoint.SPListItem.UpdateInternal(Boolean bSystem, Boolean bPreserveItemVersion, Guid newGuidOnAdd, Boolean bMigration, Boolean bPublish, Boolean bNoVersion,
    Boolean bCheckOut, Boolean bCheckin, Boolean suppressAfterEvents)     at Microsoft.SharePoint.SPListItem.Update()     at Microsoft.SharePoint.Workflow.SPWinOEWSSService.CommitUpdateListItem(Transaction txn, Object[]
    transData)     at Micro...    
    03/14/2014 12:30:29.86*    w3wp.exe (0x7698)                           0x7A94    Windows SharePoint Services 
         Workflow Infrastructure           72fe    High        ...soft.SharePoint.Workflow.SPPendingWork.PerformWorkNow(Transaction txn)    
    at Microsoft.SharePoint.Workflow.SPPendingWorkBatch.Commit(Transaction transaction, ICollection items)    
    03/14/2014 12:30:30.05     w3wp.exe (0x7698)                           0x7A94    Windows SharePoint Services 
         Workflow Infrastructure           88xr    Unexpected    WinWF Internal Error, terminating workflow Id# 2dc6002d-9f9d-474f-84cf-329025347ec5    
    03/14/2014 12:30:30.05     w3wp.exe (0x7698)                           0x7A94    Windows SharePoint Services 
         Workflow Infrastructure           98d4    Unexpected    System.Workflow.Runtime.Hosting.PersistenceException: This task is currently locked by a running workflow
    and cannot be edited. ---> Microsoft.SharePoint.SPException: This task is currently locked by a running workflow and cannot be edited.     at Microsoft.SharePoint.SPListItem.PrepareItemForUpdate(Guid newGuidOnAdd, SPWeb web, Boolean
    bMigration, Boolean& bAdd, Boolean& bPublish, Object& objAttachmentNames, Object& objAttachmentContents, Int32& parentFolderId)     at Microsoft.SharePoint.SPListItem.UpdateInternal(Boolean bSystem, Boolean bPreserveItemVersion,
    Guid newGuidOnAdd, Boolean bMigration, Boolean bPublish, Boolean bNoVersion, Boolean bCheckOut, Boolean bCheckin, Boolean suppressAfterEvents)     at Microsoft.SharePoint.SPListItem.Update()     at Microsoft.SharePoint.Workflow.SPWi...  
    03/14/2014 12:30:30.05*    w3wp.exe (0x7698)                           0x7A94    Windows SharePoint Services 
         Workflow Infrastructure           98d4    Unexpected    ...nOEWSSService.CommitUpdateListItem(Transaction txn, Object[] transData)     at
    Microsoft.SharePoint.Workflow.SPPendingWork.PerformWorkNow(Transaction txn)     at Microsoft.SharePoint.Workflow.SPPendingWorkBatch.Commit(Transaction transaction, ICollection items)     at System.Workflow.Runtime.WorkBatch.PendingWorkCollection.Commit(Transaction
    transaction)     at System.Workflow.Runtime.WorkBatch.Commit(Transaction transaction)     at System.Workflow.Runtime.Hosting.WorkflowCommitWorkBatchService.CommitWorkBatch(CommitWorkBatchCallback commitWorkBatchCallback)    
    at System.Workflow.Runtime.Hosting.DefaultWorkflowCommitWorkBatchService.CommitWorkBatch(CommitWorkBatchCallback commitWorkBatchCallback)     at System.Workflow.Runtime.WorkflowExecutor.CommitTransaction(Activity activityContext) 
    03/14/2014 12:30:30.05*    w3wp.exe (0x7698)                           0x7A94    Windows SharePoint Services 
         Workflow Infrastructure           98d4    Unexpected    ...   at System.Workflow.Runtime.WorkflowExecutor.Persist(Activity dynamicActivity, Boolean
    unlock, Boolean needsCompensation)     --- End of inner exception stack trace ---     at System.Workflow.Runtime.WorkflowExecutor.Persist(Activity dynamicActivity, Boolean unlock, Boolean needsCompensation)    
    at System.Workflow.Runtime.WorkflowExecutor.System.Workflow.ComponentModel.IWorkflowCoreRuntime.PersistInstanceState(Activity activity)     at System.Workflow.ComponentModel.Activity.MarkClosed()     at System.Workflow.ComponentModel.Activity.ReleaseLockOnStatusChange(IActivityEventListener`1
    eventListener)     at System.Workflow.ComponentModel.FaultAndCancellationHandlingFilter.SafeReleaseLockOnStatusChange(ActivityExecutionContext context)     at System.Workflow.ComponentModel.FaultAndCancella...  
    03/14/2014 12:30:30.05*    w3wp.exe (0x7698)                           0x7A94    Windows SharePoint Services 
         Workflow Infrastructure           98d4    Unexpected    ...tionHandlingFilter.OnEvent(Object sender, ActivityExecutionStatusChangedEventArgs e)    
    at System.Workflow.ComponentModel.ActivityExecutorDelegateInfo`1.ActivityExecutorDelegateOperation.Run(IWorkflowCoreRuntime workflowCoreRuntime)     at System.Workflow.Runtime.Scheduler.Run()    
    03/14/2014 12:30:30.38     w3wp.exe (0x7698)                           0x6C9C    Windows SharePoint Services 
         General                           0    Unexpected    ERROR: request not found
    in the TrackedRequests. We might be creating and closing webs on different threads. ThreadId = 59, Free call stack =    at Microsoft.SharePoint.SPRequestManager.Release(SPRequest request)     at Microsoft.SharePoint.SPWeb.Invalidate()    
    at Microsoft.SharePoint.SPWeb.Close()     at Microsoft.SharePoint.SPSite.Close()     at Microsoft.SharePoint.SPSite.Dispose()     at Microsoft.SharePoint.Workflow.SPWorkflowManager.RunWorkflow(SPWorkflow
    workflow, Collection`1 events, SPRunWorkflowOptions runOptions)     at Microsoft.SharePoint.Workflow.SPWorkflowManager.RunWorkflow(SPWorkflow workflow, Collection`1 events)     at Microsoft.SharePoint.Workflow.SPWinOEItemEventReceiver.RouteWorkflowEvent(SPItemEventProperties
    properties, SPWeb web, SPListItem item, Boolean fNeedTas...    
    03/14/2014 12:30:30.38*    w3wp.exe (0x7698)                           0x6C9C    Windows SharePoint Services 
         General                           0    Unexpected    ...kReset)    
    at Microsoft.SharePoint.Workflow.SPWinOEItemEventReceiver.ItemUpdated(SPItemEventProperties properties)     at Microsoft.SharePoint.SPEventManager.RunItemEventReceiver(SPItemEventReceiver receiver, SPItemEventProperties properties, SPEventContext
    context, String receiverData)     at Microsoft.SharePoint.SPEventManager.RunItemEventReceiverHelper(Object receiver, Object properties, SPEventContext context, String receiverData)     at Microsoft.SharePoint.SPEventManager.<>c__DisplayClass8`1.<InvokeEventReceivers>b__0()    
    at Microsoft.SharePoint.SPSecurity.CodeToRunElevatedWrapper(Object state)     at Microsoft.SharePoint.SPSecurity.RunAsUser(SPUserToken userToken, Boolean bResetContext, WaitCallback code, Object param)     at Microsoft.SharePoint.SPSecurity.RunAsUser(SPUserToken
    03/14/2014 12:30:30.38*    w3wp.exe (0x7698)                           0x6C9C    Windows SharePoint Services 
         General                           0    Unexpected    ...userToken, CodeToRunElevated
    code)     at Microsoft.SharePoint.SPEventManager.InvokeEventReceivers[ReceiverType](SPUserToken userToken, RunEventReceiver runEventReceiver, Object receivers, Object properties, Boolean checkCancel)     at Microsoft.SharePoint.SPEventManager.InvokeEventReceivers[ReceiverType](Byte[]
    userTokenBytes, RunEventReceiver runEventReceiver, Object receivers, Object properties, Boolean checkCancel)     at Microsoft.SharePoint.SPEventManager.HandleEventCallback[ReceiverType,PropertiesType](Object callbackData)    
    at Microsoft.SharePoint.Utilities.SPThreadPool.WaitCallbackWrapper(Object state)     at System.Threading.ExecutionContext.runTryCode(Object userData)     at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode
    code, CleanupCo...    
    03/14/2014 12:30:30.38*    w3wp.exe (0x7698)                           0x6C9C    Windows SharePoint Services 
         General                           0    Unexpected    ...de backoutCode, Object
    userData)     at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)     at System.Threading._ThreadPoolWaitCallback.PerformWaitCallbackInternal(_ThreadPoolWaitCallback
    tpWaitCallBack)     at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback(Object state)  , Allocation call stack (if present) null    

  • Error while updating pricing item

    Hi All,
    I have an issue to ask, the problem is this issue not happen every time, and sometimes it can solved it self.
    We are using SRM 5.0
    SRM_SERVER     550     0008     SAPKIBKT08     SRM_SERVER
    SAP_AP                  700     0008    SAPKNA700      SAP Application Platform
    Its about  Error while updating pricing item 49ABA6C4998216D9E1000000AC103B65 (document 49ABA6CE998216D9E1000000AC103B65) which i found in SLG1 and SM53.
    When this issue occured, all transaction cannot be process, like : transfer ext requirement from R/3 to SRM --> failed , then when generate PO from accepted quotation , the PO net price will be zero.
    All the error is the same, error has occured in pricing.
    I already check using program
    RSVMCRT_HEALTH_CHECK  and BBP_CND_CUSTOMIZING_CHECK , IPC is running and all java enviroment message status = green, but if i simulate using a product, it will show error in pricing.
    Can you please help to advise if any of you ever facing the same error, your respond will highly appreciated.
    Regards,
    w1n

    Hi,
    I think buffer has old condition.
    Please run the Function Module IPC_DET_CLEAR_CUST_BUFFER.
    OR reset the VMC -> Reset  in SM52.
    Regards,
    Masa

  • Use "Update List Item" to add multiple Values

    I'm having a List on a SharePoint 2013 Farm.
    Each Entry can be a Member of a different Entry, and also can have multiple members.
    Now i want to Update my List Items with Orchestrator IP "Update List Item" and want to add this members to my List Element. If  i try it with one member, all is fine, but i want to add multiple Members to a List Entry
    i tried to seperate with commas, semicolon, spaces, line breaks.....
    For Example:
    My list Element will repesent my Business Services like Microsoft Exchange, Microsoft Exchange Mailbox, Client, Server......
    No i want to add to the List Entry "Microsoft Exchange" the members "Exchange Mailbox" and "Client"
    Any Ideas?
    Seidl Michael | http://www.techguy.at |
    twitter.com/techguyat | facebook.com/techguyat

    Hi
    what i want to do is this
    when i configure my Activity to update twice, so one Activity vor "PowerClient" and one Activity for "A000001" only the last Entry exist, so it will overright the existing Entry.
    i am not sure how to configure the Activity to add multiple Values at once.
    Seidl Michael | http://www.techguy.at |
    twitter.com/techguyat | facebook.com/techguyat

  • How to update list item metadata?

    I want to implement lists.asmx > UpdateListItems method. In the update method (the caml) i would like to use barcode as a filter instead of item ID. http://msdn.microsoft.com/en-us/library/office/ms440289(v=office.14).aspx 
    How would my caml look like?
    <Batch OnError="Continue" ViewName="CA28BFCC-4CCE-4EF8-B08F-7824535E13FC">
    <Method ID="1" Cmd="Update">
          <Field Name='BarCode'>6061114511</Field>
          <Field Name="Title">New Title 2</Field>
    </Method>
    </Batch>

    Hi  ,
    You cannot use barcode as a filter instead of item ID by using OOTB  list.asmx. You could build your own custom web service that uses the either the SPQuery class or linq and gather the items based on
    a particular field value.
    For more information, please take a look at the thread:
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/af23f9f0-2640-474c-9616-522fcb639029/listserviceupdatelistitems-update-reference-field?forum=sharepointdevelopmentlegacy
    I recommend that you  update list items with listdata.svc.
    Reference:
    http://chuvash.eu/2011/12/15/update-list-items-with-listdata-svc/
    Best Regards,
    Eric
    Eric Tao
    TechNet Community Support

  • Update List Items using REST API - Keep Getting 400 Bad Request

    I am using code from the following answer:
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/40833576-5853-4ca4-95cf-b5b1d69f465f/sharepoint-rest-and-c-sample-to-update-list-item?forum=sharepointdevelopment
    I am having a tough time figuring out the issue though.  I have been able to retrieve list items, but now I want to update those items.  This is the following code just to get the digest information with passing in credentials:
    public static string GetFormDigest(System.Net.NetworkCredential cred)
    string formDigest = null;
    string resourceUrl = "https://SITEURL/_api/contextinfo";
    HttpWebRequest wreq = HttpWebRequest.Create(resourceUrl) as HttpWebRequest;
    wreq.Credentials = cred;
    wreq.Method = "POST";
    wreq.Accept = "application/json;odata=verbose";
    wreq.ContentLength = 0;
    wreq.ContentType = "application/json";
    string result;
    WebResponse wresp = wreq.GetResponse();
    using (StreamReader sr = new StreamReader(wresp.GetResponseStream()))
    result = sr.ReadToEnd();
    var jss = new JavaScriptSerializer();
    var val = jss.Deserialize<Dictionary<string, object>>(result);
    var d = val["d"] as Dictionary<string, object>;
    var wi = d["GetContextWebInformation"] as Dictionary<string, object>;
    formDigest = wi["FormDigestValue"].ToString();
    Console.WriteLine(formDigest);
    return formDigest;
    Then the following code is used:
    string result = string.Empty;
    Uri uri = new Uri(sharepointUrl.ToString() + "/_api/Web/lists/getByTitle('DemoList')/items(1)");
    HttpWebRequest wreq = (HttpWebRequest)WebRequest.Create(uri);
    wreq.Credentials = cred;
    wreq.Method = "POST";
    wreq.Accept = "application/json; odata=verbose";
    wreq.ContentType = "application/json; odata=verbose";
    wreq.Headers.Add( "X-HTTP-Method","MERGE");
    wreq.Headers.Add( "IF-MATCH", "*");
    wreq.Headers.Add("X-RequestDigest", GetFormDigest(cred));
    string stringData = "{'__metadata': { 'type': 'SP.Data.DemoListListItem' }, 'Title': 'updated!'}";
    wreq.ContentLength = stringData.Length;
    StreamWriter writer = new StreamWriter(wreq.GetRequestStream());
    writer.Write(stringData);
    writer.Flush();
    try {
    WebResponse wresp2 = wreq.GetResponse();
    using (StreamReader sr = new StreamReader(wresp2.GetResponseStream()))
    result = sr.ReadToEnd();
    catch (Exception e) { Console.WriteLine("An error occurred: '{0}'", e); }
    It errors out when it tries to send the command to Sharepoint.  I am NOT using a sharepoint hosted app.  I just wanted to directly contact sharepoint and update items.  Any help or suggestions would be greatly appreciated!
    Thanks,
    Priyank
     

    I just found some other code that seemed to work on editing a title and edited it kind of guessing it would work and it did!
    This is the code that ended working using the same digest code from above:
    Console.WriteLine("\n Newer Fancier Code \n");
    Uri uri = new Uri("https://SHAREPOINTURL/_api/web/lists/GetByTitle('Demo')/items(1)");
    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
    request.ContentType = "application/json;odata=verbose";
    request.Headers["X-RequestDigest"] = GetFormDigest(cred);
    request.Headers["X-HTTP-Method"] = "MERGE";
    request.Headers["IF-MATCH"] = "*";
    request.Credentials = cred;
    request.Accept = "application/json;odata=verbose";
    request.Method = "POST";
    string stringData = "{ '__metadata': { 'type': 'SP.ListItem' }, 'Location': 'updatedinfo' }";
    request.ContentLength = stringData.Length;
    StreamWriter writer = new StreamWriter(request.GetRequestStream());
    writer.Write(stringData);
    writer.Flush();
    HttpWebResponse response = (HttpWebResponse)request.GetResponse();
    StreamReader reader = new StreamReader(response.GetResponseStream());
    Just fyi if anyone was wondering.  Next, I'm going to be trying to update multiple fields, possibly multiple items if possible if anyone knows how to do that.

  • SP Designer - Update list item value error

    Hi,
    I'm making holiday requests with SP designer, and my workflow works well, however, when the manager validation task is created, I would like to add the holiday request's details (such as start date, end date, Employee ID, etc).
    So I have a list called "Holiday request" and an associated task list where all the validation tasks are stored.
    What I tried was to use the "Update list item" function to update the Employee ID value (in the validation task column I created) with the holiday request's Employee ID value. So what I did was this :
    (I initially posted a picture but I cannot, apparently)
    The list I work on is the associated task list. I chose the field "Employee ID" and set the value to "Current item : Employee ID".
    In my lookup, I've set the associated content field and in the value : "Current Item:Title"
    I have also tried to use the Current Item:ID (which would be the Holiday request's ID), but it didn't work either. I've been testing a lot and wanted to know if you guys had any suggestions ?
    Thanks a lot.
    Cheers

    Below are steps need to performed to update custom fileds in task form
    1. Create custom task content type using SharePoint 2013 workflow task.
    2. Add your fields here (start date, end date, Employee ID etc).
    3. Make sure this custom task content type is associated with workflow task list.
    4. In the assign task activity change the Task content type to your custom task content type.
    5.From the single task activity properties uncheck "Wait for Task completion".
    The below screenshot i have updated Empid in task form with current list Item id. You can update them according to your requirement.
    Hope this helps.
    My Blog- http://www.sharepoint-journey.com|
    If a post answers your question, please click Mark As Answer on that post and Vote as Helpful

  • Update list item with multiple lookup

    I want to write a workflow to append project name (from list project) to a lookup column (mutiple value) in another list. I use update list item and put follwing string in multiple lookup column:
    [%CurrentItem:ID%];#[%Current Item: Project%]
    I find the lookup column will be replaced always with new project name. But I want to append the project name to existing vaule. How can I do that?

    thank you for the replying. I have just solved this issue. I save the string every time in a column and append the project name in the string column and put the whole string in mutiple lookup column. then the new value will be appended in lookup column. it
    seems like followings:
    1. time: ID1;#Project1
    2. time: ID1;#project1;#ID2;#project2
    3. time: ID1;#project1;ID2;#project2;#ID3;#project3

  • Is it possible to query an Item with two or more conditions in OOB Update List Item WF Step

    In SharePoint Designer 2010, in Workflows, is it possible to give more then one condition when querying items? Let me explain, it is fairly easy to drop Update item in this list step, and say, for example, Update item with ID X. However, if is it possible
    to do something along this lines with OOB steps, Update an item in this list where Title is Equal to "abc" and Modify date no older then 3 days.
    Update: Workflow is started when the item is added to the list. What I would like is to update some fields on this item depending on information in this item and in external list. For example
    Current Item Field 1 has value "abc"
    Current Item Field 2 has value "123"
    Current Item Field 3 has value "456"
    External List has Item with value in Field 1 "123"
    External List has Item with value in Field 2 "abc"
    External List has Item with value in Field 3 "xyz"
    Update Current Item Field 3 with value "xyz"
    In short I would need following query - Update Current_Item_Field_3 with value from External_List_Field_3 where Field 1 is equal to Current_Item_Field_2 and Field 2 is equal to Current_Item_Field_1

    Hi,
    From your description, I understand you want to update list item with workflow based on two or more conditions.
    To resolve your issue, you need to use “If current item field equals value” condition. Use this condition to compare a field in the current item that the list or reusable list workflow is currently running on to a value. Values can be static text, dynamic
    strings, and lookups to variables, context information, or other SharePoint fields. And you can learn more about each condition by referring to the article:
    https://support.office.com/en-in/article/Workflow-conditions-in-SharePoint-Designer-2010-A-quick-reference-guide-d8e33ac7-9336-487f-a60b-388c4ea497ff?ui=en-US&rs=en-IN&ad=IN
    I assume your External List is called “ListB”, and Current List is called “ListA”, You can follow the steps below:
    1. Add “If current item field equals value" for condition that ListB Field2 equals to ListA Field1, then set the second condition “ListB Field1 equal to ListA Field2” as the “Find the List Item” in the “Lookup for Single line of text”
    as the screenshot below:
    2. Add “Update List Item” as the screenshot below for updating Current_Item_Field_3 with value from External_List_Field_3. In addition, you should set “Find the List Item” in “Lookup for Single line of text” same to the “Find the List Item” in step 1:
    In addition, if you have more conditions, you could add “If current item field equals value” condition, and you should set each “Find the List Item” in “Lookup for Single line of text” same to the “Find the List Item” in step 1.
    Regards,
    Rebecca Tu
    TechNet Community Support

  • How to disable chanllenging questions while user log in for first time

    Hi All,
    How to disable challenging questions while user log in for first time in OIM 10g and OIM 11g
    also i need to know how to change the Oracle logo with custom logo in both versions

    In 11G:
    To disable challenge questions at start up: http://download.oracle.com/docs/cd/E17904_01/doc.1111/e14308/system_props.htm#BABBDCJH (System Property Named: "Force to set question at start up)
    To change logo: http://download.oracle.com/docs/cd/E14571_01/doc.1111/e14309/uicust.htm#CHDIFJEJ
    In 10G:
    Dig the documentation.
    A suggestion, please go through the documents first as they have quite a bit of information.
    HTH,
    BB

  • Set the custom timer job that copy the data in the same list

    Hi
    How to set the custom timer job that copy the data in the same list
    Thanks,

    hello
    please it is wrong to copy all of the list3 item in list1 as the example as below is a copy of one item.
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using Microsoft.SharePoint;
    //This namespace is used for the SPJobDefinition class
    using Microsoft.SharePoint.Administration;
    namespace GENERAL_CustomTimerJob
    //To create a custom timer job, first add a class to your SharePoint project and
    //inherit from SPJobDefinition. Implement the constructors and override the Execute
    //method as shown below. To install your timer job, and set the schedule, you must
    //add a Feature and a Feature receiver.
    class GENERAL_CustomTimerJob :
    SPJobDefinition
    #region Constructors
    //You must implement all three constructors
    public GENERAL_CustomTimerJob()
    base()
    public GENERAL_CustomTimerJob(string jobName,
    SPService service,
    SPServer server, SPJobLockType targetType)
    base(jobName, service, server, targetType)
    public GENERAL_CustomTimerJob(string jobName,
    SPWebApplication webApplication)
    base(jobName, webApplication,
    null, SPJobLockType.ContentDatabase)
    //Set the title of the job, which will be shown in the Central Admin UI
    this.Title = "Simple Example Timer Job";
    #endregion
    //Override the Execute method to run code.
    public override
    void Execute(Guid targetInstanceId)
    //Get the Web Application in which this Timer Job runs
    SPWebApplication webApp =
    this.Parent as
    SPWebApplication;
    //Get the site collection
    SPSiteCollection timerSiteCollection = webApp.ContentDatabases[targetInstanceId].Sites;
    //Get the Announcements list in the RootWeb of each SPSite
    SPList timerJobList =
    null;
    foreach (SPSite site
    in timerSiteCollection)
                    timerJobList = site.RootWeb.Lists.TryGetList("List3");
    if (timerJobList != null)
    string sourceUrl = "http://aydi-pc";
    string destinationUrl =
    "http://aydi-pc/sites/Site1/";
    string sourceList = "List3";
    string destinationList =
    "List1";
    using (SPSite sourceSite =
    new SPSite(sourceUrl))
    using (SPWeb sourceWeb = sourceSite.OpenWeb())
    using (SPSite destSite =
    new SPSite(destinationUrl))
                                    using
    (SPWeb destWeb = destSite.OpenWeb())
    SPList ObjSourcelist = sourceWeb.Lists.TryGetList(sourceList);
    SPList ObjDestinationlist = destWeb.Lists.TryGetList(destinationList);
    SPListItem newItem = ObjDestinationlist.Items.Add();
    SPListItemCollection items = ObjSourcelist.Items;
                                        if
    (items.Count > 0)
    foreach (SPListItem item
    in items)
    newItem["Title"] = item["Title"];
    newItem["Nom"] = item["Nom"];
    newItem["Prenom"] = item["Prenom"];
    newItem.Update();

  • Tutorial on how to update list items using ListData.svc

    Can you please point me to a tutorial which shows how to update a list item using listdata.svc and C#?
    Sorry if this is FAQ.
    I have found articles on read list... but I haven't found anything on update a list item.
    val it: unit=()

    when i try this I get an error 500
    I created an ASP.NET web application that allows the user to modify data that is stored in SharePoint I rather not go into the reasons why this application was created but focus more on why doesn't the listdata.svc allow me to update a task item that was
    created by a workflow collect data from user action.
    1. The workflow creates the item.
    I collect the item and update the item using the below code. This is not an OOTB approval workflow that is just the name I used. When I get to save changes I received the following error code.
    Dim getApprovalItem As ExpenseApprovalRuleBasedTasksItem = spContext.ExpenseApprovalRuleBasedTasks.Where(Function(i) i.Id = Pam.ApprovalItemID).FirstOrDefault
    If String.IsNullOrEmpty(getApprovalItem.AuditorApprovalValue) Then
    getApprovalItem.AuditingComments = approvalComments
    Select Case approvalDecision
    Case "Approved"
    getApprovalItem.AuditorApproval = ExpenseApprovalRuleBasedTasksAuditorApprovalValue.CreateExpenseApprovalRuleBasedTasksAuditorApprovalValue("Approved")
    getApprovalItem.AuditorApprovalValue = "Approved"
    Case "Rejected"
    getApprovalItem.AuditorApproval = ExpenseApprovalRuleBasedTasksAuditorApprovalValue.CreateExpenseApprovalRuleBasedTasksAuditorApprovalValue("Rejected")
    getApprovalItem.AuditorApprovalValue = "Rejected"
    End Select
    getApprovalItem.Outcome = "Completed"
    getApprovalItem.Status = ExpenseApprovalRuleBasedTasksStatusValue.CreateExpenseApprovalRuleBasedTasksStatusValue("Completed")
    getApprovalItem.StatusValue = "Completed"
    getApprovalItem.Complete = True
    spContext.UpdateObject(getApprovalItem)
    spContext.SaveChanges()
    End If

Maybe you are looking for

  • Mail going to DRAFTS

    I have a Yosemite 10.10.1/OSX Server 4 network. One client machine, new iMac also with 10.10.1, is consistently finding his outbound email going to the DRAFTS folder, and not being sent.  However, when he re-sends from DRAFTS, the mail goes out. What

  • How to create a New Excel File programmatically

    Hi ! I am documenting acquired data continuously in an excel file, what I need to do is to create a new excel file automatically when the size of the previous file exceeds a certain limit lets say 1MB. I have tried using the simple 'Create/Open File'

  • Network timeout only for library upgrade items

    I purchased an upgrade of my library, which totals 430 songs. The purchase went through fine, but when I would try to "check for downloads" so I could download the items, I kept getting "network timeout" errors. I ran the diagnostics, and after sendi

  • Question / Suggestion - OrderBy (Sorting) Feature by Clicking.

    Maybe there is a way to do this and someone can fill me in, or maybe this will be another suggestion for consideration. When I open a connection to an oracle DB, then click on a specific table. A worksheet popups with Columns Tab in focus. I'd like t

  • The application "Creative Cloud" can't be opened -1701

    Ran into an odd issue, the creative cloud desktop never initialized, it tried to but was never able to connect, (not an internet issue at all, just some kind of installation issue) So the message "the application "Creative Cloud" can't be opened -170