Export (0) Print
Expand All

Clear push notification registrations from the subscription store in SharePoint 2013

SharePoint 2013
 

Applies to: SharePoint Server 2013, SharePoint Foundation 2013

Topic Last Modified: 2013-12-18

Summary: Learn how to make room for more applications and devices by clearing the push notification subscription store on a SharePoint 2013 site.

SharePoint Server 2013 supports applications on mobile devices that receive push notifications from a SharePoint site. Notifications can include events that occur in the site, such as when a user adds an item to a list or updates an item. When the push notification feature is activated, a subscription store is created at the website level to store information from devices that have registered with the SharePoint site to receive notifications. This subscription store is created as a hidden list that cannot be viewed directly by a user or an administrator. When the device application registers to receive notifications or unregisters from receiving notifications on the SharePoint site, a device entry is either added or deleted in the list based on the request.

ImportantImportant:
To enable mobile device registration on a site, the push notifications feature must be activated. Previously, you could activate or deactivate push notifications in the site settings under Site Actions and Manage Site Features. However, the option to enable is not available through Manage Site Features in this release, and must be programmatically activated. The below section Activate push notifications will detail how to enable the feature. For more information about the Windows Phone push notifications development model including sample register and unregister API usage, see Push notifications in SharePoint apps for Windows Phone.

There might be a scenario where a user registers to receive notifications through an application, but then the user no longer uses the application or device, or the user uninstalls the application from the device. If the unregister API is not called from the application, the device entry will still exist in the subscription store. There is a limit of 2,000 device registrations for push notifications in SharePoint Server 2013. Once this limit is reached, no further registrations can be performed unless entries are cleared from the subscription store. This article provides the procedures necessary to clear specific device entries that have not been updated in the subscription store for 30 days, or the entire contents of the subscription store based on preference.

In this article:

In SharePoint Server 2013 the push notifications feature must be enabled in order for devices to receive SharePoint-based push notifications. You can enable the feature by using a SharePoint Server 2013 cmdlet, or through a client application. The following steps provide instruction on how to enable the feature using the Windows PowerShell cmdlet.

To activate the push notifications feature
  1. Verify that the user account that is performing this procedure has the necessary permissions to use SharePoint Server 2013 cmdlet or scripting.

    ImportantImportant:
    To run a Windows PowerShell for SharePoint Server 2013 cmdlet or script:
    1. Verify that you are a member of the following security roles or groups:

      • securityadmin fixed server role on the SQL Server instance.

      • db_owner fixed database role on all databases that are to be updated.

      • Administrators group on the server on which you are running the Windows PowerShell cmdlets or scripts.

      • Add memberships that are required beyond the minimums above.

    2. An administrator can use the Add-SPShellAdmin cmdlet to grant permissions to use SharePoint Server 2013 cmdlets or scripts. Also, the default execution policy for scripts in SharePoint 2013 is set to Restricted. You must adjust the execution policy setting in order to run scripts. For more information, see Scripts and execution policies in SharePoint 2010 Products administration by using Windows PowerShell.

  2. On the Start menu, click All Programs.

  3. Click Microsoft SharePoint 2013 Products.

  4. Click SharePoint 2013 Management Shell.

  5. To activate the push notifications feature, at the Windows PowerShell command prompt, enter the following code:

    Enable-SPFeature -Identity 41e1d4bf-b1a2-47f7-ab80-d5d6cbba3092 -URL <YOUR SITE URL>
    
    
    

    Where <YOUR SITE URL> is the URL of your SharePoint site.

Use this procedure to remove device registrations from the subscription store that have not been updated in 30 days. It is implied that devices that have not connected to the computer that is running SharePoint Server by using the register API in that time frame are considered inactive, and should be marked for deletion. However, this time limit of 30 days can also be adjusted through the OffsetDays attribute in the following script based on preference.

ImportantImportant:
This cleanup process will also clear device preferences that might have been set in the registration information. For more information about the Windows Phone push notifications development model including sample register and unregister API usage, see Push notifications in SharePoint apps for Windows Phone.
To delete select registrations from the subscription store
  1. Verify that the user account that is performing this procedure has the necessary permissions to use SharePoint Server 2013 cmdlets as explained in step 1 in the section Activate push notifications.

  2. On the Start menu, click All Programs.

  3. Click Microsoft SharePoint 2013 Products.

  4. Click SharePoint 2013 Management Shell.

  5. To delete select registrations that have not been updated in 30 days, at the Windows PowerShell command prompt, enter the following code:

    $web = Get-SPWeb "<YOUR SITE URL>"
    $store = $web.Lists["Push Notification Subscription Store"]
    $spQuery = New-Object Microsoft.SharePoint.SPQuery
    $spQuery.Query = '<Where><Lt><FieldRef Name="Modified" /><Value Type="DateTime"><Today OffsetDays="-30" /></Value></Lt></Where>'
    $oldItems = $store.GetItems($spQuery)
    foreach ($item in $oldItems) { $store.Items.DeleteItemById($item.Id) }
    write-output "Successfully deleted all old subscriptions"
    

    Where <YOUR SITE URL> is the URL of your SharePoint site.

Use this procedure to remove all registrations or subscriptions from the push notifications subscription store.

To delete all registrations from the subscription store
  1. Verify that the user account that is performing this procedure has the necessary permissions to use SharePoint Server 2013 cmdlets as explained in step 1 in the section Activate push notifications.

  2. On the Start menu, click All Programs.

  3. Click Microsoft SharePoint 2013 Products.

  4. Click SharePoint 2013 Management Shell.

  5. To delete all device registrations or subscriptions, at the Windows PowerShell command prompt, enter the following code:

    write-output "Delete all push notification subscribers"
    $web = Get-SPWeb "<YOUR SITE URL>"
    $spList = $web.Lists["Push Notification Subscription Store"] 
    write-output "Got the Subscription Store"
    foreach ($item in $spList.items)
    {
        $itemToDelete=$spList.GetItemById($item.ID)
        $ itemToDelete.Delete() 
    }
    write-output "Successfully deleted all subscribers"
    
    

    Where <YOUR SITE URL> is the URL of your SharePoint site.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft