1

I'm trying to access the "Client_Title/Page Title" from a page in Site Pages using Client Context and "listItemId". It seems that I'm not requesting or loading it the correct way.

When debugging I see that ListItemId is the valid Id of the item.

I appreciate every help I can get.

Problem pic

1

I've reworked your code to resolve the issue

  • store the GetById in a variable before sending out the query
  • make sure you include client title in the query of the item
  • it seems you are composing many queries that you end up not using since you know the id of the item you want

e.g.

var changedItem2 = listitem.GetById(listitemId);            
context.Load(changedItem2, item => item.Client_Title);
context.ExecuteQuery();

var title2 = changedItem2.Client_Title;

EDIT:

an even better approach would be to do a single query line and get rid of everything else

var changedItem2 = context.Web.Lists.GetByTitle("Site Pages").GetItemById(listitemId);
context.Load(changedItem2, item => item.Client_Title);
context.ExecuteQuery();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.