0

I am trying to remove all Mysite newsfeed comments via powershell in preparation for a new site release (getting debugging and test comments out, etc.)...

I am using the Remove-SPSocialItemByDate powershell command (http://technet.microsoft.com/en-us/library/ff607934(v=office.15).aspx) and following multiple examples found there and in the Powershell for sharepoint 2013 How-To... but I consistently get the same error.

code:

Add-PsSnapIn Microsoft.SharePoint.PowerShell
##This script removes comments, ratings and tags made before EndDate value
$userProfProxy = Get-SPServiceApplicationProxy | where { $_.DisplayName -eq 'User Profile Service Application' }
$userProfProxy
Remove-SPSocialItemByDate -ProfileServiceApplicationProxy $userProfProxy -RemoveComments 1 -EndDate 7/1/2014

Error:

Name Type Id
---- ---- --
User Profile Serv... User Profile Serv... 08d859ab-14e6-45a0-80cb-e2c74c312422

Remove-SPSocialItemByDate : Query processor could not produce a query plan because of the hints defined in this query. Resubmit the query without specifying any hints and without using SET FORCEPLAN. At line:7 char:1 + Remove-SPSocialItemByDate -ProfileServiceApplicationProxy $userProfProxy -Remove ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidData: (Microsoft.Offic...moveSocialItems:SPCmdletRemoveSocialItems) [Remove-SPSocialItemByDate], SqlException + FullyQualifiedErrorId : Microsoft.Office.Server.UserProfiles.PowerShell.SPCmdletRemoveSocialItems

1 Answer 1

0

Try this.

Add-PsSnapIn Microsoft.SharePoint.PowerShell
$userProfProxy = Get-SPServiceApplicationProxy | where { $_.DisplayName -eq 'User Profile Service Application' }
Remove-SPSocialItemByDate -RemoveComments 1 -ProfileServiceApplicationProxy $userProfProxy -EndDate 7/1/2014

To remove tag

Remove-SPSocialItemByDate -RemoveTags 1 -ProfileServiceApplicationProxy c6681d53-e6c4-432f-9f31-22d3de81b00c -EndDate 9/15/2009
2
  • Maybe I'm not seeing correctly, but this looks just like the code that I posted that is not working.
    – Robbie
    Commented Jul 4, 2014 at 17:11
  • the order is different. The code that i posted is state -RemoveComment before -ProfileServiceApplicationProxy
    – Supermode
    Commented Jul 7, 2014 at 0:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.