2

I want try to get Infopath form id after add to form library by following code

spFile = fileLibrary.Files.Add(fileName, fileContents, replaceExistingFiles);

and I can't access spFile.Item.Id because I added file to form library and I receive this error:

The object specified does not belong to a list.

Is there any efficient way to get id by name? I tried to get id by file URL but there is no Item.Id again.

3
  • I think its case sensitive. Try using spFile.Item.ID
    – Asad Refai
    Commented Mar 3, 2016 at 12:33
  • thanks for your replay and of curse its case sensitive and if its wrong error occurs on compile time not run time
    – Mehdi
    Commented Mar 4, 2016 at 15:55
  • No worries. I posted as an answer.
    – Asad Refai
    Commented Mar 4, 2016 at 16:17

1 Answer 1

0

The properties are case sensitive in SharePoint. Normally its ID

So try below code

spFile.Item.ID

This should solve the problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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