Пример #1
0
        private static void DeleteFormFromSource()
        {
            // Configure the source environment.
            // TODO: Set the SharePoint web URL for the source environment.
            const string sourceUrl = "http://source.com";

            // TODO: Set the content type ID of the content type for the source environment.
            // Use an empty string ("") to denote the default content type for the SharePoint list.
            const string sourceContentTypeId = "";

            // TODO: Set the list ID of the SharePoint list for the source environment.
            // Remember to enclose the GUID in curly brackets ({}).
            const string sourceListId = "{00000000-0000-0000-0000-000000000000}";

            // Create a client context for the source environment.
            var sourceCtx = new NfClientContext(sourceUrl, ClientCredentials, ClientVersion);

            // Delete the form from the source environment.
            DeleteFormFromList(sourceCtx, sourceContentTypeId, sourceListId);
        }
Пример #2
0
        private static void GetFormFromSourceAndPublishToDestinationList()
        {
            // Configure the source environment.
            // TODO: Set the SharePoint web URL for the source environment.
            const string sourceUrl = "http://sp131:82/";

            // TODO: Set the content type ID of the content type for the source environment.
            // Use an empty string ("") to denote the default content type for the SharePoint list.
            const string sourceContentTypeId = "";

            // TODO: Set the list ID of the SharePoint list for the source environment.
            // Remember to enclose the GUID in curly brackets ({}).
            const string sourceListId = "{b0e621d9-3d9f-4f69-a8d3-e180adc083d3}";

            // Configure the destination environment.
            // TODO: Set the SharePoint web URL for the destination environment.
            const string destinationUrl = "http://sp131:82/";

            // TODO: Set the content type ID of the content type for the destination environment.
            // Use an empty string ("") to denote the default content type for the SharePoint list.
            const string destinationContentTypeId = "";

            // TODO: Set the list ID of the SharePoint list for the destination environment.
            // Remember to enclose the GUID in curly brackets ({}).
            const string destinationListId = "{b0e621d9-3d9f-4f69-a8d3-e180adc083d3}";

            // Create a client context for the source environment.
            var sourceCtx = new NfClientContext(sourceUrl, ClientCredentials, ClientVersion);

            // Create a client context for the destination environment.
            var destinationCtx = new NfClientContext(destinationUrl, ClientCredentials, ClientVersion);

            // Get the form from the source environment, and publish it to the destination environment.
            GetFormFromListAndPublishToList(sourceCtx, sourceContentTypeId, sourceListId,
                                            destinationCtx, destinationContentTypeId, destinationListId);
        }
Пример #3
0
        private static void GetFormFromSourceAndSaveToFile()
        {
            // Configure the source environment.
            // TODO: Set the SharePoint web URL for the source environment.
            const string sourceUrl = "http://*****:*****@"d:\temp\form.xml";

            // Create a client context for the source environment.
            var sourceCtx = new NfClientContext(sourceUrl, ClientCredentials, ClientVersion);

            // Get the form from the source environment, and save it to the specified file.
            GetFormFromListAndSaveToFile(sourceCtx, sourceContentTypeId, sourceListId, filePath);
        }
Пример #4
0
        private static void GetFormFromListAndPublishToList(NfClientContext sourceContext, string sourceContentTypeId, string sourceListId, NfClientContext destinationContext, string destinationContentTypeId, string destinationListId)
        {
            // Read the form definition XML by invoking the GetFormXml method
            // from the client context for the source environment.
            Console.WriteLine("Getting form...");
            string formXml = sourceContext.GetFormXml(sourceListId, sourceContentTypeId);

            // Publish the form definition XML by invoking the PublishForm method
            // from the client context for the destination environment.
            Console.WriteLine("Publishing form...");
            var result = destinationContext.PublishForm(destinationListId, destinationContentTypeId, formXml);

            // Display the version number of the published form to the console.
            Console.WriteLine("Successfully published version: {0}", result.Version);
        }