Created
April 19, 2024 13:01
-
-
Save shemogumbe/bfb38e018e5ce15b98b8b0d2433d7ba0 to your computer and use it in GitHub Desktop.
Delete profile picture
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
# Endpoint URL | |
url = "https://graph.microsoft.com/v1.0/me/photo/$value" | |
# Token (replace with your actual token) | |
token = "<your-token-here>" | |
# Headers | |
headers = { | |
"Authorization": f"Bearer {token}", | |
} | |
# Send DELETE request | |
response = requests.delete(url, headers=headers) | |
# Check response status | |
if response.status_code == 200: | |
print("Profile photo deleted successfully!") | |
else: | |
print("Failed to delete profile photo. Status code:", response.status_code) | |
print("Response:", response.text) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This prints out the message:
"Profile photo deleted successfully!"
and the profile picture is now empty on GE, REQUEST