Share via

CSOM code is not working after adding custom domain to MS365 Tenant

Anonymous
2022-07-25T03:55:01+00:00

Hi,

Recently, my organisation added custom domain and user upn also changed according to it. Now, CSOM code is giving error as "The Application ID (AppID) For Which The Service Ticket Is Requested Does Not Exist On The System".

Error screenshot:

SCRIPT BELOW

Add-Type -Path "D:\CSOM Code Test\Microsoft.SharePoint.Client.dll" 

Add-Type -Path "D:\CSOM Code Test\Microsoft.SharePoint.Client.Runtime.dll" 

$siteURL = https://XXXX.sharepoint.com/sites/MF 

$userId = SVC_SPO.Mig_Acc1@X****

$pwd = Read-Host -Prompt "Enter Password" -AsSecureString 

$creds = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($userId, $pwd) 

$ctx = New-Object Microsoft.SharePoint.Client.ClientContext($siteURL) 

$ctx.credentials = $creds 

try{ 

    $lists = $ctx.web.Lists 

    $list = $lists.GetByTitle("VMs") 

    $listItems = $list.GetItems([Microsoft.SharePoint.Client.CamlQuery]::CreateAllItemsQuery()) 

    $ctx.load($listItems) 

    $ctx.executeQuery() 

    foreach($listItem in $listItems) 

    { 

        Write-Host "ID - " $listItem["ID"] "Title - " $listItem["Title"] 

    } 

catch{ 

    write-host "$($_.Exception.Message)" -foregroundcolor red 

}

Microsoft 365 and Office | SharePoint | For business | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

2 answers

Sort by: Most helpful
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

  2. Anonymous
    2022-07-25T05:57:41+00:00

    Dear K SANTOSHKUMAR,

    Good day! Thank you for posting in Microsoft Community.

    According to the information you provided, we understand the situation is that CSOM code is giving error after you added custom domain to tenant.

    We'd love to help you. Considering we mainly focus on general queries and build-in features' troubleshooting in SharePoint Online, we're afraid we may have limited resource about CSOM code issues. And considering we have a dedicated channel Microsoft Q&A Community - SharePoint, for you to be assisted properly, we sincerely recommend you go to that community and post a new thread, members and engineers over there are proficient in the knowledge of CSOM code. They will focus on the specific situation on your side and share specific suggestions. We are sure that our experts from that team can address your query effectively and accurately.

    Thanks for your cooperation and understanding!

    Hope you keep safe and healthy always!

    Sincerely,

    Tina | Microsoft Community Moderator

    ***Note: In the event that you're unable to reply to this thread, please ensure that your Email address is verified in the Community Website by clicking on Your Account Name > "My Profile" > "Edit Profile" > Add your Email Address > tick "Receive email notifications" checkbox > click on "Save".***

    Was this answer helpful?

    0 comments No comments