public static void ReplaceWebPart() { string SharePointOnline_OR_OnPremise = "OP"; string UserName = "******"; string Password = "******"; string Domain = "MGMT7"; string webUrl = "https://intranet.poc.com/sites/TestContosoPublishingSite/"; string serverRelativePageUrl = "/sites/TestContosoPublishingSite/Pages/TestWebPartTransformation.aspx"; string outPutDirectory = @"F:\481921\ReplaceWebPart\replace"; string webPartZoneIndex = "0"; string webPartZoneID = "TopLeftRow"; string targetWebPartFileName = "Haveyoursay.dwp"; string targetWebPartXmlFile = @"E:\v-suamso\FTC-CAMSimulation\TransformationTool\TestingResults\ConfigureNewWebPartXml\Bulk\TargetContentQuery.xml"; Guid sourceWebPartID = new Guid("b3d55ff9-d032-45e1-9670-cd442ba5cab3"); WebPartTransformationHelper webPartTransformationHelper = new WebPartTransformationHelper(); webPartTransformationHelper.ReplaceWebPart(webUrl, targetWebPartFileName, targetWebPartXmlFile, sourceWebPartID, webPartZoneIndex, webPartZoneID, serverRelativePageUrl, outPutDirectory, SharePointOnline_OR_OnPremise, UserName, Password, Domain); }
protected override void ProcessRecord() { WebPartTransformationHelper webPartTransformationHelper = new WebPartTransformationHelper(); webPartTransformationHelper.ReplaceWebPart(WebUrl, TargetWebPartFileName, TargetWebPartXmlFile, new Guid(SourceWebPartID), WebPartZoneIndex, WebPartZoneID, ServerRelativePageUrl, OutPutDirectory, SharePointOnline_OR_OnPremise, UserName, Password, Domain, "web"); }