PowerShell Value does not fall within the expected range

Kamil Buszmann 5 Reputation points
2023-07-11T12:40:38.9633333+00:00

HI. I'm trying to apply template for site. When it applies an error occurs when step is "List instances". Error is "Value does not fall within the expected range" when applies column called "_ModernAudienceAadObjectIds".

User's image

Elementy zawartości witryny > Site Content Elements

Did you have similar or the same problem ?

Best regars

Kamil

Microsoft 365 and Office SharePoint For business Windows
Windows for business Windows Server User experience PowerShell
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Xyza Xue_MSFT 30,176 Reputation points Microsoft External Staff
    2023-07-12T06:58:24.43+00:00

    Hi @Kamil Buszmann ,

    The error message "Value does not fall within the expected range" occurs when trying to apply a template for a site, specifically when applying a column called "_ModernAudienceAadObjectIds" to a list instance. This error message often appears when a list item or a field contains too much data, or when the value is too long.

    To troubleshoot this issue, try the following steps:

    1.Check the specific column "_ModernAudienceAadObjectIds" for any unusual or long values and try shortening it.

    2.Ensure that the column is added to the list or library and that it exists.

    3.If the issue persists, you can try debugging your script to identify and isolate the issue.

    One post on GitHub suggests that after applying a PnP template, site admins should disable and enable audience targeting again in list settings to remove fields _ModernAudienceTargetUserField and _ModernAudienceAadObjectIds and then recreate them properly.

    Note: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make sure that you completely understand the risk before retrieving any suggestions from the above link.

    Hope the information can help you. And if there have any unclear or misunderstanding, please feel free to post back and we’ll continue to help you all the time!

    Your understanding and patience will be highly appreciated! Hope you have a good day and keep safe!


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.