Using client id and secret to pull SharePoint online data from site

DonnaSmith 151 Reputation points
2023-09-20T13:05:42.3833333+00:00

Hi all

Have a SharePoint site with a list, a powershell to pull data from the list and log to shared drive - this works fine when running the script adhoc using;

Connect-PnPOnline -Url $SiteURL -UseWebLogin

If I create an app, add/approve this in SharePoint for the site or list in question and then run the following it produces no output in the location specified;

Connect-PnPOnline -Url $SiteURL -clientid $clientid -clientsecret $secret -warningaction Ignore

Cant see what the issue could be - apps been approved for id/secret to work, no authentication failure, just no results. Anything glaringly obvious that could be the problem? Can post full script if needed however only things being changed is the logon option in connection line

Thanks

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. Anonymous
    2023-09-21T07:13:21.7133333+00:00

    Hi @DonnaSmith
    Please refer to this document first to see if the problem can be solved.

    Then if possible please provide your code for reference:

    Here is a link for your reference:

    https://www.sharepointdiary.com/2019/03/connect-pnponline-with-appid-and-appsecret.html


    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.

    Best Regards

    Cheng Feng


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.