locked
"Moving" and "Moved" event receivers are not called when *Move-SPSite* cmdlet is used on SP 2016 RRS feed

  • Question

  • Hi,

    I am SP developer currently working on 3rd party RBS provider implementation. Recently I noticed that Move-SPSite cmdlet does not call SPFile and SPSite synchronous "moving" and asynchronous "moved" event receivers (after correct registration) on SP 2016.

    Would you help me to find a way how to "hook" on both of these "move" events? Without that capability I am not able to detect when customer is about to move site collection from one content database to another.  

    Thank you!

    Regards 


    Pavol Rachel, SharePoint Developer.

    Monday, March 19, 2018 9:43 AM

Answers

All replies

  • Hi,

    Move-SPSite is for site collection level, while WebMoving/WebMoved is SPWeb level event there are only SiteDeleting and SiteDeleted events for site collection level, check below thread for similar question.

    https://social.msdn.microsoft.com/Forums/SqlServer/en-US/c0fe95ed-80f5-4fb9-af9e-4447b5183422/movespsite-fired-events?forum=sharepointdevelopmentprevious

    As a workaround, you could create log file for your powershell command to monitor this.

    Here is one thread for your reference.

    https://www.c-sharpcorner.com/blogs/creating-log-file-in-powershell-script1

    Best Regards,

    Lee


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.


    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    • Proposed as answer by Dennis Guo Thursday, March 22, 2018 8:40 AM
    Tuesday, March 20, 2018 2:51 AM
  • Hi Lee,

    I verified that WebMoving and WebMoved event receivers are not called on SP site collection root web when Move-SPSite cmdlet has been used with RBS (RbsProviderMapping parameter)

    Is that expected?

    If so, would you official state that it's not possible to register and use WebMoving and WebMoved events with SP site collection root web.

    Thank you!


    Pavol Rachel, SharePoint Developer.

    Wednesday, March 21, 2018 1:19 PM
  • Hi,

    Root web also a web, not site collection, they are different scopes.

    https://social.technet.microsoft.com/Forums/en-US/528d5413-3904-4aa2-a72e-a6da2952703b/difference-bw-spsiterootweb-and-spsiteallwebs-top-level-site?forum=sharepointgeneralprevious

    You could prepare a script with has ‘Log’ capability and ask users who do Move-SPSite to use the script, so the operations could be record in log as shared previously.

    Best Regards,

    Lee


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.


    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    Thursday, March 22, 2018 2:55 AM
  • Hi Lee,

    Would you confirm me that there is no event receiver which could *signal* move operations on SPSite or SPWeb (site collection root web) object? Is that *event injection* the only possible workaround how to react on Move-SPSite cmdlet? No event receivers even on SPWeb level?

    Regards,

    Pavol Rachel, SharePoint Developer.

    Friday, March 23, 2018 9:58 AM
  • Hi,

    No event receiver maps Move-SPSite cmdlet.

    Here is available SPWeb level and site collection events.


    WebMoving event.


    https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spwebeventreceiver.webmoving.aspx?f=255&MSPPError=-2147217396

    Best Regards,

    Lee


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.


    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    Monday, March 26, 2018 1:21 AM
  • Hi Lee,

    I found that even FILESTREAM RBS provider has issues with Move-SPSite cmdlet. I was able to install ALL necessary FILESTREAM RSB provider components on two content databases, each with one site collection and one PDF document), content was correctly offloaded into two separate BLOB stores and SP was able to download documents. After running the following cmdlet:

    Move-SPSite '<site collection 1>' -DestinationDatabase "<target content database 2>" -RbsProviderMapping @{"FilestreamProvider_1"="FilestreamProvider_1"} -Confirm:$false

    I always get the following SQL server error:

    Move-SPSite : RBS Error. Original Error: Number 2627, Severity 14, State 1, Procedure mssqlrbs.rbs_sp_add_pool, Line 34,
    Message: Violation of PRIMARY KEY constraint 'rbs_internal_pools_pk'. Cannot insert duplicate key in object 
    'mssqlrbs_resources.rbs_internal_pools'. The duplicate key value is (1, 0x01000000).
    Transaction count after EXECUTE indicates a mismatching number of BEGIN and COMMIT statements. Previous count = 2, current count = 0.
    Transaction count after EXECUTE indicates a mismatching number of BEGIN and COMMIT statements. Previous count = 2, current count = 0.
    Transaction count after EXECUTE indicates a mismatching number of BEGIN and COMMIT statements. Previous count = 2, current count = 0.
    Transaction count after EXECUTE indicates a mismatching number of BEGIN and COMMIT statements. Previous count = 2, current count = 0.
    Transaction count after EXECUTE indicates a mismatching number of BEGIN and COMMIT statements. Previous count = 1, current count = 0.
    At line:2 char:1
    ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidData: (Microsoft.Share...PCmdletMoveSite:SPCmdletMoveSite) [Move-SPSite], SPCmdletException
        + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletMoveSite

    After reviewing 'mssqlrbs_resources.rbs_internal_pools' DB table I realized that FILESTREAM API seems to be not ready for *move* operation (as there is very high chance that both tables will have the same values resulting to primary key violation issue) 

    Would you confirm me if this is bug or just not supported scenario in SP 2016
    Thanks!


    Pavol Rachel, SharePoint Developer.

    Monday, April 2, 2018 8:09 PM
  • Hi,

    Without the ability to *hook* on (currently not existing) moving and moved SP site collection events the only applicable option seems to me to wrap up Move-SPSite cmdlet functionality under the custom cmdlet to have the process under the control.

    Before that, user should verify if SP 2016 farm contains June 2018 CU fix containing important fix related to RBS functionality:
    https://support.microsoft.com/en-us/help/4022173/description-of-the-security-update-for-sharepoint-enterprise-server-20

    Regards,
          

    Pavol Rachel, SharePoint Developer.

    • Marked as answer by pavol.rachel Monday, August 6, 2018 12:13 PM
    Monday, August 6, 2018 12:13 PM