I have a scenario where I want to be able to make multiple subscriptions to Microsoft graph in the same tenant. But when I try to do so, even thought the resource of my post request is different from the first subscription, it will show me the following message:
"Status Code: Conflict; Reason: A subscripton already exists. It must be deleted before a another can be made."
Example:
This are the parameters I am using for my first subscription which is successful:
let presenceSubscriptionOptions = {
method: "POST",
url: "https://graph.microsoft.com/v1.0/subscriptions",
headers: {
"Content-Type": "application/json",
Authorization: userToken,
},
data: JSON.stringify({
changeType: "updated",
clientState: "MyGraphExplorerSecretClientState",
notificationUrl: notificationUrl,
resource: "/communications/presences?$filter=id in ('70c5d24f-82b0-443f-8d7f-5acd754f2467','7287a48e-6f92-4cb2-ac8e-af236db330ae','90e78e73-4c99-44a6-8dcb-5616bbd24ce0','438a42cb-772d-44bc-95cc-cf63cdd78c93')",
expirationDateTime: expirationDateTime,
}),
};
This are the parameters I am using for my second subscription which is unsuccessful:
let presenceSubscriptionOptions = {
method: "POST",
url: "https://graph.microsoft.com/v1.0/subscriptions",
headers: {
"Content-Type": "application/json",
Authorization: userToken,
},
data: JSON.stringify({
changeType: "updated",
clientState: "MyGraphExplorerSecretClientState",
notificationUrl: notificationUrl,
resource: "/communications/presences?$filter=id in ('70c5d24f-82b0-443f-8d7f-5acd754f2467','7287a48e-6f92-4cb2-ac8e-af236db330ae','0b167637-747c-420f-acb7-9830c1a35d3d','438a42cb-772d-44bc-95cc-cf63cdd78c93','90e78e73-4c99-44a6-8dcb-5616bbd24ce0')",
expirationDateTime: expirationDateTime,
}),
};
The change in both is a user id in the resource and the userToken.
Is the problem with my post request parameter? An azure AD configuration or something else?