0
votes

Trying to modify a label.

My code:

service.Users.Messages.Modify(mods, userId, messageId).Execute();

Error message:

The service gmail has thrown an exception: Google.GoogleApiException: Google.Apis.Requests.RequestError Insufficient Permission [403] Errors [ Message[Insufficient Permission] Location[ - ] Reason[insufficientPermissions] Domain[global] ]

at Google.Apis.Requests.ClientServiceRequest1.Execute() in C:\Apiary\v1.25\Src\Support\GoogleApis\Apis\Requests\ClientServiceRequest.cs:line 101 at CreditRecon.DownloadAttachment.ModifyMessage(GmailService service, String userId, String messageId, List1

1

1 Answers

0
votes

In order to update a users messages you need the permission of the user.

Insufficient Permission

Means that you do not have the permission of the authenticated user modify their messages.

Re-authenticate your user and make sure you have requested one of the following scopes of permissions from them

https://mail.google.com/
https://www.googleapis.com/auth/gmail.modify

Update reauthencate user:

To reset authentication change "[email protected]" to something else. or go into your credPath and delete the file with that as its name. It will prompt you to authenticate again.