Correcting an activity page owner (making it match the one specified in the [Participants] detail )

Question

I cannot delete a participant from an activity. The error message informs that I canot delete the Owner, but the participant in fact IS NOT the owner.

Answer

-- downgrading to a participant
SELECT ac.Id, Title, OwnerId, ap.ParticipantId, ap.Id as ApId FROM Activity ac
LEFT JOIN ActivityParticipant ap on ap.RoleId = '53fc4a92-b0ea-e111-96c4-00165d094c12'
AND ac.Id = ap.ActivityId
WHERE OwnerId <> ap.ParticipantId
--
UPDATE ActivityParticipant SET RoleId = '1a8324e8-a6e1-df11-971b-001d60e938c6'
WHERE Id In (
SELECT ap.Id FROM Activity ac
LEFT JOIN ActivityParticipant ap on ap.RoleId = '53fc4a92-b0ea-e111-96c4-00165d094c12'
AND ac.Id = ap.ActivityId
WHERE OwnerId <> ap.ParticipantId
)
-- upgrading to an owner
SELECT ac.Id, Title, OwnerId, ap.ParticipantId, ap.Id as AppId, ap.RoleId FROM Activity ac
LEFT JOIN ActivityParticipant ap on ac.Id = ap.ActivityId
WHERE ac.OwnerId = ap.ParticipantId AND
ap.RoleId <> '53fc4a92-b0ea-e111-96c4-00165d094c12'
--
UPDATE ActivityParticipant Set RoleId = '53fc4a92-b0ea-e111-96c4-00165d094c12'
WHERE Id In (
SELECT ap.Id FROM Activity ac
LEFT JOIN ActivityParticipant ap on ac.Id = ap.ActivityId
WHERE ac.OwnerId = ap.ParticipantId AND
ap.RoleId <> '53fc4a92-b0ea-e111-96c4-00165d094c12'
)

 

Like 0

Like

Share

0 comments
Show all comments