Is it possible to get SP List Item by unique Id (without writing a Caml request) if I know a related List Id.
var item = list.GetItemById("CFA9E204-6509-424B-A246-0DE5295C42B2");
When I tried to get item using this code, I received an error: "Input string was not in a correct format."
What's wrong with the GetItemById() method?
Why does it has an overloaded method GetItemById() with a string argument if it understands only integer Id?
EDIT:
I use SharePoint Client Object Model where List entity has no a method GetItemByUniqueId(), but it has the GetItemById() method, which receives string or integer Id.
MSDN Documentation
SharePoint lists have an ID column (hidden by default) which contains a unique number for each entry. It is possible to establish a calculated column in the SharePoint list using this value, however it will break if the list is updated by a Power Automate flow.
After opening the list you want to modify, click Add column > Show/hide columns if you want to show the ID column(which you may have already done).
In a database or spreadsheet, unique identifiers may be designated as a specific column or field to help make sorting and filtering through information easier. This also helps trace information back to a specific user or entity within the system.
Try this:
SPListItem item = list.GetItemByUniqueId(new Guid("CFA9E204-6509-424B-A246-0DE5295C42B2"));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With