/// <summary> /// Called when [site import started]. /// </summary> /// <param name="sender">The sender.</param> /// <param name="args">The <see cref="Microsoft.SharePoint.Deployment.SPDeploymentEventArgs"/> instance containing the event data.</param> private void OnSiteImportStarted(object sender, SPDeploymentEventArgs args) { SPImportObjectCollection rootObjects = args.RootObjects; if (rootObjects.Count != 0) { if (rootObjects.Count != 1) { for (int i = 0; i < rootObjects.Count; i++) { if (rootObjects[i].Type == SPDeploymentObjectType.Web) { rootObjects[i].TargetParentUrl = m_webParentUrl; rootObjects[i].TargetName = m_webName; return; } } } else { rootObjects[0].TargetParentUrl = m_webParentUrl; rootObjects[0].TargetName = m_webName; } } }
private void OnStarted(object sender, SPDeploymentEventArgs args) { SPImportObjectCollection rootObjects = args.RootObjects; if (rootObjects.Count != 0) { if (rootObjects.Count == 1) { if (rootObjects[0].Type == SPDeploymentObjectType.Web) { rootObjects[0].TargetParentUrl = this.m_webParentUrl; rootObjects[0].TargetName = this.m_webName; } else { rootObjects[0].TargetParentUrl = this.m_webParentUrl + this.m_webName; } } else { bool rootFound = false; for (int i = 0; i < rootObjects.Count; i++) { rootObjects[i].TargetParentUrl = this.m_webParentUrl; if (rootObjects[i].Type == SPDeploymentObjectType.Web) { if (rootFound) { throw new SPException(SPResource.GetString("ImportOperationMultipleRoots", new object[0])); } rootFound = true; rootObjects[i].TargetName = this.m_webName; return; } } } } }