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
Similar Messages
-
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. -
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 -
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/techguyatHi
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 -
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. -
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 -
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.
ThanksWell, 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 -
Please tell me how to handle list item in this concern
please tell me how to handle list item in this concern
My problem is:
i have a category table with column categoryname(varchar type)
I want to display the records of categoryname in a drop down list (i.e., list item )
So ..please tell me how to do it
Thanks in advance..This code is just a sample from the Help documentation. It won't work until you modify it for your form.
Why do you have "steps" in your code? You are suppose to do what the steps tell you. You don't place the steps in your code. The steps must be removed from your code.
Step 1 code goes in a program unit, not in a trigger.
Step 2 and 3 code usually goes in a trigger.
You will have to replace the names of the items and record group with your own names as you have defined them in your form.
step 1: create a procedure in your application
procedure load_list(itm in VARCHAR2, rg in VARCHAR2) is
group_id RecordGroup := Find_Group(rg);
list_id Item := Find_Item(itm);
Begin
if Populate_Group(group_id)<>0 then
Message('Unable to populate record group');
Raise Form_Trigger_Failure;
end if;
Clear_List(list_id);
Populate_list(list_id, group_id);
end;
step 2: create a record group named rg_cat and assign Record Group Query to something like "select categoryname from category"
step 3: call this procedure as
load_list('categoryname','rg_cat'); -
How to copy List item from one list to another using SPD workflow using HTTP call web service
Hi,
How to copy List item from one list to another using SPD workflow using HTTP call web service.
Both the Lists are in different Web applications.
Regards, Shreyas R SHi Shreyas,
From your post, it seems that you are using SharePoint 2013 workflow platform in SPD.
If that is the case, we can use Call HTTP web service action to get the item data, but we cannot use Call HTTP web service to create a new item in the list in another web application with these data.
As my test, we would get Unauthorized error when using Call HTTP web service action to create a new item in a list in another web application.
So I recommend to achieve this goal programmatically.
More references:
https://msdn.microsoft.com/en-us/library/office/jj164022.aspx
https://msdn.microsoft.com/en-us/library/office/dn292552.aspx?f=255&MSPPError=-2147217396
Thanks,
Victoria
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] -
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.
CheersBelow 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 -
How to get List Item attachments name without write any custom code or any database query?
Hi,
How to get List Items attachments name without write any custom code or any database query?You can get it from Rest,
There are 2 options,
1) create a 'Result Source' which has a search query for that List which has attachments
- Use rest query to get the 'Filename' , it will have the attachment file name
For example, if the result source id is : 73e6b573-abf8-4407-9e5f-8a85a4a95159 , then the query will be
http://[site URL]/_api/search/query?querytext='*'&selectproperties='Title,Path,FileExtension,SecondaryFileExtension,Filename'&sourceid='73e6b573-abf8-4407-9e5f-8a85a4a95159'&startrow=0&rowLimit=100
You can refine the query, be giving proper 'querytext'
2) Use the List rest api
For example if your list guid is :38d524a1-e95c-439f-befd-9ede6ecd242e
You can get he attachments for 1st item using this
http://[Site URL]/_api/lists(guid'38d524a1-e95c-439f-befd-9ede6ecd242e')/items(1)/AttachmentFiles
get2pallav
Please click "Propose As Answer" if this post solves your problem or "Vote As Helpful" if this post has been useful to you. -
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_1Hi,
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 -
Using SharePoint 2010 Server
I'm attempting to programtically update a managed metadata field in a document library. I'm able to do it without issue on all other non-managed metadata fields. When I attempt it on a MM field I get the error message
"The security validation for this page is invalid. Click Back in your Web browser, refresh the page, and try your operation again."
After some digging I realised that this error was being caused because SharePoint was trying to write to the TaxonomyHiddenList list (../sites/mysite/Lists/TaxonomyHiddenList/AllItems.aspx)
When I update a document through the browser with a term (Term01), it shows up in this TaxonomyHiddenList . I can then run my application, apply Term01 to my new document and it works fine. But if I apply Term02 to my new document it gives me the error above.
Summary
My app can read the TaxonomyHiddenList fine but it can not perform an operation that would write to it, resulting in not being able to update the MM field.
Question
Is there any advice on how I can further debug this issue?Hi,
According to your post, my understanding is that you want to update managed metadata field in document library programmatically.
I have made a simple code demo below to updata managed metadata field in document library, it works like a charm, you can refer to it.
public static void UpdateMSField()
using (SPSite site = new SPSite("http://YourSiteURL"))
using (SPWeb web = site.OpenWeb())
//SPList list = web.Lists.TryGetList("Libs_1");
SPDocumentLibrary lib = (SPDocumentLibrary)web.Lists["Libs_1"];
// No point in proceeding if we can't find the list
if (lib != null)
// add a new item
// SPListItem item = list.AddItem();
SPListItem item = lib.GetItemById(1);
//Console.WriteLine(item.Name);
// get the current taxonomy session, which wraps up all of the
// associated TermStore objects for this SPSite object
TaxonomySession metadataService = new TaxonomySession(site);
// get the taxonomy field
TaxonomyField taxField = item.Fields["MMS_1"] as TaxonomyField;
// get the term store associated with the taxonomy field
TermStore termStore = metadataService.TermStores[taxField.SspId];
// get the actual term set associated with the taxonomy field
TermSet termSet = termStore.GetTermSet(taxField.TermSetId);
// search for the terms we wish to set the field to
var terms = termSet.GetTerms("term_1", true, StringMatchOption.ExactMatch, 1, false);
// if we have found a term populate the field
if (terms.Count > 0)
// set the field to the term(s) we have found
taxField.SetFieldValue(item, terms.First());
// Update the item
item.Update();
Console.WriteLine("success...");
More reference:
http://www.3guysonsharepoint.com/?p=1052
http://vineet-winit.blogspot.com/2013/04/how-to-update-managed-metadata-field-in.html
Thanks & Regards,
Jason
Jason Guo
TechNet Community Support -
How to Update multiple items in other list using event handler?
Hi All,
If i update a item in a list, then i should update multiple items in another list need to be update. How to achive using event receivers?Hi Sam,
According to your description, my understanding is that you want to update multiple items in another list when updated a list item.
In the event receiver, you can update the multiple item using Client Object Model.
Here is a code snippet for your reference:
public override void ItemUpdated(SPItemEventProperties properties)
string siteUrl = "http://sp2013sps/sites/test/";
ClientContext clientContext = new ClientContext(siteUrl);
List oList = clientContext.Web.Lists.GetByTitle("another list name");
ListItem oListItem = oList.GetItemById(1);
oListItem["Title"] = "Hello World Updated!";
oListItem.Update();
clientContext.ExecuteQuery();
Best regards,<o:p></o:p>
Zhengyu Guo
Zhengyu Guo
TechNet Community Support -
How to create list items with multiple attachment files using rest api javascript
In one of user form I am using javascript rest api to create a list item with multiple attachment files. So far I am able to create list item and once created uploading an attachment file. But this is two step process first create an item and then upload
a file.
It create an additional version of the item which is not desired. Also I am not able find a way to attach multiple files in a go. Following is the code I am using.
createitem.executeAsync({
url: "/_api/web/lists/GetByTitle('UserForm')/items(1)/AttachmentFiles/add(FileName='" + aFile.name + "')",
method: "POST",
contentType: "application/json;odata=verbose",
headers: {
"Accept": "application/json;odata=verbose",
"X-RequestDigest": $("#__REQUESTDIGEST").val()
binaryStringRequestBody: true,
body: fileContent,
success: fnsuccess,
error: fnerror
So somehow I need to combine item attributes along with attachment files in body: param. I visited https://msdn.microsoft.com/en-us/library/office/dn531433.aspx#bk_ListItem but no success.
Appreciate any help.Thanks Mahesh for the reply and post you share it was useful.
But this does not solve the core of the issue. You are uploading attachments after creation of item and multiple files are being attached in loop. This is kind of iterative update to an existing item with attachments. This will end up creating multiple versions.
What I am trying to achieve is to create an item along with multiple attachments in a go. No item updates further to attach a file.
Please suggest how this can be done in one go. SharePoint does it when one creates an item with multiple attachment.
Thanks for your reply.
Maybe you are looking for
-
How can I view an AI file created on a MAC on a PC without corrupting the fonts?
How can I view an AI file created on a MAC on a PC without corrupting the original fonts? An AI file was created with an image and text on a MAC. When the AI file was opened on a PC, the text fonts were not the same as originally created. Also, th
-
Hello, My events appear in the EventHub, but they are not handled by any of my stream analytics 4 jobs. No errors in the operation logs. Monitor (of all 4 jobs) displays 0 (zero) input events. Please help. Thanks/ Janiv Ratson. Technology and Develop
-
Hi, we are using thumbnail images for representing some employee status in a table. Images are displayed successfully. Problem is the white space between two cells, we want to eliminate the space between two cells. I have tried cell width property bu
-
Has anyone else had their screen stuck on "processing" forever, after trying to rent a movie?
-
Hi! I have to give 10 new offer letters to employees in my organization. Name of employee in each offer letter is repeated three times. I want to have some option so as there is some pop up box generated for entering name of employee and when I'll en