You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have come across something odd. I am looking for DocumentNumber, the following code works most of time time.
var myList = context.Web.Lists.GetByTitle("Current", p => p.Title,
p => p.All,
p => p.Fields.QueryProperties(p => p.InternalName,
p => p.FieldTypeKind,
p => p.TypeAsString,
p => p.Title));
await foreach (var listItem in myList.Items)
{
// Do something with the list item
if (listItem["Campus"].ToString() == "Cambridge")
{
if (listItem.Values.GetValueOrDefault("N_x002f_DocumentNumber") == null)
{
Console.WriteLine("I got here");
//IFile testDocument = context.Web.GetFileById(listItem.Values.GetValueOrDefault("ContentTypeId").ToString();
}
Console.WriteLine($"{Intcounter} : Location:{listItem.Values.GetValueOrDefault("Campus")} : ");
Console.WriteLine($"{Intcounter} : Filename:{listItem.Values.GetValueOrDefault("N_x002f_DocumentNumber")} : ");
Console.WriteLine($"{Intcounter} : Revision:{listItem.Values.GetValueOrDefault("Revision")} : ");
Console.WriteLine($"{Intcounter} : ReleaseDate:{listItem.Values.GetValueOrDefault("ReleaseDate")} : ");
Console.WriteLine($"{Intcounter} : Title:{listItem.Title} : ");
Console.WriteLine($"{Intcounter} : Id:{listItem.Id} : ");
Console.WriteLine($" ");
}
}
what I am finding is that in some cases, "N_x002f_DocumentNumber" is actually null. there is a Campus, Revision, Title, Id.
now when I look at the site online, I can get the document number it is the column called "name".
I was wondering if anyone would have some insight on how to get the name in call cases?
I thought of trying to get the File by Guid, but I can only find the Server URL. When I try that, I get the follwoing error message:
PnP.Core.SharePointRestServiceException: 'SharePoint Rest service exception'
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello,
I have come across something odd. I am looking for DocumentNumber, the following code works most of time time.
var myList = context.Web.Lists.GetByTitle("Current", p => p.Title,
p => p.All,
p => p.Fields.QueryProperties(p => p.InternalName,
p => p.FieldTypeKind,
p => p.TypeAsString,
p => p.Title));
what I am finding is that in some cases, "N_x002f_DocumentNumber" is actually null. there is a Campus, Revision, Title, Id.

now when I look at the site online, I can get the document number it is the column called "name".
I was wondering if anyone would have some insight on how to get the name in call cases?
I thought of trying to get the File by Guid, but I can only find the Server URL. When I try that, I get the follwoing error message:
PnP.Core.SharePointRestServiceException: 'SharePoint Rest service exception'
thank you
Philippe
Beta Was this translation helpful? Give feedback.
All reactions