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

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,300 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,462 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Haoyan Xue_MSFT 22,466 Reputation points Microsoft Vendor
    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