Skip to content

Loading Team Tabs fails with error "System.FormatException: Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)." #1407

@nicolaor

Description

@nicolaor

Category

  • Bug

Describe the bug

When trying to load team tabs using PnPContext we get the following exception:

  • System.FormatException:Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)

Steps to reproduce

This is the code we are executing (the exception happens on line 83)
image

Here is the Stacktrace:

System.FormatException: Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).
at System.Guid.GuidResult.SetFailure(Boolean overflow, String failureMessageID)
at System.Guid.TryParseExactN(ReadOnlySpan1 guidString, GuidResult& result) at System.Guid.TryParseGuid(ReadOnlySpan1 guidString, GuidResult& result)
at System.Guid.Parse(ReadOnlySpan1 input) at System.Guid.Parse(String input) at PnP.Core.Services.JsonMappingHelper.GetJsonFieldValue(IDataModelWithContext pnpObject, String fieldName, ApiResponse apiResponse, JsonElement jsonElement, Type propertyType, Boolean useCustomMapping, Func2 fromJsonCasting)
at PnP.Core.Services.JsonMappingHelper.FromJsonGraph(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.FromJsonGraph(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.ProcessGraphRestBatchResponse(Batch batch, String batchResponse)
at PnP.Core.Services.BatchClient.ExecuteMicrosoftGraphBatchRequestAsync(Batch batch)
at PnP.Core.Services.BatchClient.ExecuteMicrosoftGraphBatchAsync(Batch batch)
at PnP.Core.Services.BatchClient.ExecuteBatch(Batch batch)
at PnP.Core.Model.BaseDataModel1.BaseRetrieveAsync(ApiCall apiOverride, Func2 fromJsonCasting, Action1 postMappingJson, Expression1[] expressions)
at CN365Common.Validation.Validators.CN365Template.ChannelTabs.Validate(PnPContext pnpContext, String channelId) in /home/vsts/work/1/s/CN365Common/Validation/Validators/CN365Template/ChannelTabs.cs:line 83

Based on the PnP model of TeamChannelTab, the Id is expected to be a Guid, but in our case we have multiple Channels where the Tab-Id seems to be an Integer.
Here the results from the Graph Request
image

Definition in PnP Model
image

Expected behavior

Teams Tabs can be loaded into PnP model even if the Tab-Id is not a Guid

Environment details (development & target environment)

  • SDK version: 1.11.0
  • OS: Linux
  • SDK used in: Azure Function
  • Framework: .NET 6.0

Additional context

This behavior seems to affect only older teams, newly created Teams always have use Guids for the Tab Ids
The above Team was created in April 2020.

Metadata

Metadata

Assignees

Labels

area: model 📐Related to the core SDK modelsbugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions