So I have on the test SharePoint 2013 server. I have created a number of entries over a number of last few days.
I found about the Remove-SPSocialItemByDate command. The details for the TechNet article are:
https://technet.microsoft.com/en-us/library/ff607934.aspx
I got the GUID for the User Profile application using this
Get-SPServiceApplicationProxy >”E:\backup\output.txt”
Which gives us – e61c84b5-4d79-452c-8025-d0fb90c1d098. I also used another command
$upaSAType = “User Profile Service Application”
$upa = Get-SPServiceApplication | where-object {$_.TypeName -eq $upaSAType}
$upa.id
And that gave me 1ff57208-ee79-4df7-a5d2-07dd2ca6164a but when I run using the 1ff57208-ee79-4df7-a5d2-07dd2ca6164a I get the following error:-
Remove-SPSocialItemByDate -RemoveComments $True -ProfileServiceApplicationProxy 1ff57208-ee79-4df7-a5d2-07dd2ca6164a -EndDate 9/5/2016
Remove-SPSocialItemByDate : Value cannot be null.
Parameter name: applicationProxy
At line:1 char:1
+ Remove-SPSocialItemByDate -RemoveComments $True -ProfileServiceApplicationProxy …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo         : InvalidData: (Microsoft.Offic…moveSocialItems:SPCmdletRemoveSocialItems) [Remove-SPSocialItemByDate], ArgumentNullException
+ FullyQualifiedErrorId : Microsoft.Office.Server.UserProfiles.PowerShell.SPCmdletRemoveSocialItems
Prior to this I was getting the error
UserProfileApplicationProxy.ApplicationProperties ProfilePropertyCache does not have <GUID>
And found this article
which at least got me to the next error message.
When I use the User Profile GUID as
Remove-SPSocialItemByDate -RemoveComments 1Â -ProfileServiceApplicationProxy e61c84b5-4d79-452c-8025-d0fb90c1d098 -EndDate 9/5/2016
I keep getting the error
PS C:\Windows\system32> Remove-SPSocialItemByDate -EndDate 09/05/2016 -ProfileServiceApplicationProxy e61c84b5-4d79-452c-8025-d0fb90c1d098 -RemoveComments $True -RemoveRatings $True -RemoveTags $True -ErrorAction Continue -Verbose -WarningAction Continue
VERBOSE: Leaving BeginProcessing Method of Remove-SPSocialItemByDate.
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:1 char:1
+ Remove-SPSocialItemByDate -EndDate 09/05/2016 -ProfileServiceApplicationProxy e6 …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo         : InvalidData: (Microsoft.Offic…moveSocialItems:SPCmdletRemoveSocialItems) [Remove-SPSocialItemByDate], SqlException
+ FullyQualifiedErrorId : Microsoft.Office.Server.UserProfiles.PowerShell.SPCmdletRemoveSocialItems
VERBOSE: Leaving ProcessRecord Method of Remove-SPSocialItemByDate.
VERBOSE: Leaving EndProcessing Method of Remove-SPSocialItemByDate.
Based on that example I have tried removing tags comments and ratings but am getting stumped with the error message.
I searched for the error but am getting something to do with the SQL queries which is not going anywhere.
I saw some of the solutions but don’t think it’s the correct one.
Anyone go any idea on this? Please do let me know and thanks in advance.
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