Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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

share|improve this question

1 Answer 1

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
share|improve this answer
    
Maybe I'm not seeing correctly, but this looks just like the code that I posted that is not working. –  Robbie Jul 4 at 17:11
    
the order is different. The code that i posted is state -RemoveComment before -ProfileServiceApplicationProxy –  Supermode Jul 7 at 0:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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