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
Checking the TaxonomyFieldValue in CSOM i can see that TermGuid is defined as a string.
[Remote]
public string TermGuid
{
get
{
return m_termGuid;
}
set
{
m_termGuid = value;
}
}
The TermId in IFieldTaxonomyValue is defined as Guid
While CSOM is able to return List-Item with
<d:LeadStatus m:type="SP.Taxonomy.TaxonomyFieldValue">
<d:Label>26</d:Label>
<d:TermGuid/>
<d:WssId m:type="Edm.Int32">26</d:WssId>
</d:LeadStatus>
PnP.Core will fail to parse TermGuid and throw an Error:
Type = System.FormatException
Message = One of the identified items was in an invalid format.
Source = System.Text.Json.Rethrowable
TargetSite = System.Guid GetGuid()
HResult = -2146233033
StackTrace = at System.Text.Json.JsonElement.GetGuid()
at PnP.Core.Model.SharePoint.FieldTaxonomyValue.FromJson(JsonElement json)
at PnP.Core.Services.JsonMappingHelper.ProcessSpecialRestFieldTypeAsync(TransientObject pnpObject, String propertyName, JsonElement json)
at PnP.Core.Services.JsonMappingHelper.FromJsonRest(TransientObject pnpObject, EntityInfo entity, ApiResponse apiResponse, Func2 fromJsonCasting) at PnP.Core.Services.JsonMappingHelper.FromJson(TransientObject pnpObject, EntityInfo entity, ApiResponse apiResponse, Func2 fromJsonCasting)
at PnP.Core.Model.BaseDataModel1.ProcessResponseAsync(ApiResponse apiResponse, Expression1[] expressions)
at PnP.Core.Services.JsonMappingHelper.FromJsonRest(TransientObject pnpObject, EntityInfo entity, ApiResponse apiResponse, Func2 fromJsonCasting) at PnP.Core.Services.JsonMappingHelper.FromJson(TransientObject pnpObject, EntityInfo entity, ApiResponse apiResponse, Func2 fromJsonCasting)
at PnP.Core.Services.JsonMappingHelper.MapJsonToModel(BatchRequest batchRequest)
at PnP.Core.Services.BatchClient.ProcessSharePointRestInteractiveResponse(BatchRequest restRequest, HttpStatusCode statusCode, Dictionary2 responseHeaders, Stream responseContent) at PnP.Core.Services.BatchClient.ExecuteSharePointRestInteractiveAsync(Batch batch) at PnP.Core.Services.BatchClient.ExecuteSharePointRestBatchAsync(Batch batch) at PnP.Core.Services.BatchClient.ExecuteBatch(Batch batch) at PnP.Core.Model.BaseDataModel1.RequestAsync(ApiCall apiCall, HttpMethod method, String operationName)
at PnP.Core.QueryModel.BaseDataModelExtensions.BaseGetAsync[T](IQueryable1 source, ApiCall apiCall, Expression1[] selectors)
at PnP.Core.Model.SharePoint.ListCollection.GetByServerRelativeUrlAsync(String serverRelativeUrl, Expression`1[] selectors)
Steps to reproduce
Unfortunately i could not find out how to get into this situation yet. First idea was that cloud happen when referred Term is deleted but test shows that Value of TermGuid remains to have the Guid as string. The List is created from a List Template but they not contain values...
@czullu : I've made the TermId parsing more resilient and set Guid.Empty when the passed string is not a GUID, hope this fixes things for you. Closing this now, but please re-open when not working and share the new stacktrace
Category
Describe the bug
Checking the TaxonomyFieldValue in CSOM i can see that TermGuid is defined as a string.
[Remote]
public string TermGuid
{
get
{
return m_termGuid;
}
set
{
m_termGuid = value;
}
}
The TermId in IFieldTaxonomyValue is defined as Guid
While CSOM is able to return List-Item with
<d:LeadStatus m:type="SP.Taxonomy.TaxonomyFieldValue">
<d:Label>26</d:Label>
<d:TermGuid/>
<d:WssId m:type="Edm.Int32">26</d:WssId>
</d:LeadStatus>
PnP.Core will fail to parse TermGuid and throw an Error:
Type = System.FormatException
Message = One of the identified items was in an invalid format.
Source = System.Text.Json.Rethrowable
TargetSite = System.Guid GetGuid()
HResult = -2146233033
StackTrace = at System.Text.Json.JsonElement.GetGuid()
at PnP.Core.Model.SharePoint.FieldTaxonomyValue.FromJson(JsonElement json)
at PnP.Core.Services.JsonMappingHelper.ProcessSpecialRestFieldTypeAsync(TransientObject pnpObject, String propertyName, JsonElement json)
at PnP.Core.Services.JsonMappingHelper.FromJsonRest(TransientObject pnpObject, EntityInfo entity, ApiResponse apiResponse, Func
2 fromJsonCasting) at PnP.Core.Services.JsonMappingHelper.FromJson(TransientObject pnpObject, EntityInfo entity, ApiResponse apiResponse, Func
2 fromJsonCasting)at PnP.Core.Model.BaseDataModel
1.ProcessResponseAsync(ApiResponse apiResponse, Expression
1[] expressions)at PnP.Core.Services.JsonMappingHelper.FromJsonRest(TransientObject pnpObject, EntityInfo entity, ApiResponse apiResponse, Func
2 fromJsonCasting) at PnP.Core.Services.JsonMappingHelper.FromJson(TransientObject pnpObject, EntityInfo entity, ApiResponse apiResponse, Func
2 fromJsonCasting)at PnP.Core.Services.JsonMappingHelper.MapJsonToModel(BatchRequest batchRequest)
at PnP.Core.Services.BatchClient.ProcessSharePointRestInteractiveResponse(BatchRequest restRequest, HttpStatusCode statusCode, Dictionary
2 responseHeaders, Stream responseContent) at PnP.Core.Services.BatchClient.ExecuteSharePointRestInteractiveAsync(Batch batch) at PnP.Core.Services.BatchClient.ExecuteSharePointRestBatchAsync(Batch batch) at PnP.Core.Services.BatchClient.ExecuteBatch(Batch batch) at PnP.Core.Model.BaseDataModel
1.RequestAsync(ApiCall apiCall, HttpMethod method, String operationName)at PnP.Core.QueryModel.BaseDataModelExtensions.BaseGetAsync[T](IQueryable
1 source, ApiCall apiCall, Expression
1[] selectors)at PnP.Core.Model.SharePoint.ListCollection.GetByServerRelativeUrlAsync(String serverRelativeUrl, Expression`1[] selectors)
Steps to reproduce
Unfortunately i could not find out how to get into this situation yet. First idea was that cloud happen when referred Term is deleted but test shows that Value of TermGuid remains to have the Guid as string. The List is created from a List Template but they not contain values...
Expected behavior
Return the Field as Null if TermGuid is Empty
Environment details (development & target environment)
current dev Branch
The text was updated successfully, but these errors were encountered: