Independentsoft
- any library, any programming language
Home
Purchase
Support
Company
Contact
Share .NET
>
Tutorial
> Publish file
The following example shows you how to publish and how to approve file.
C# example
using System; using System.Net; using Independentsoft.Share; namespace Sample { class Program { static void Main(string[] args) { try { Service service = new Service("https://independentsoft.sharepoint.com", "username", "password"); bool publishSuccess = service.Publish("/Shared Documents/Test2.docx", "Check-in comment for the publish."); Console.WriteLine("Publish success = " + publishSuccess); bool approveSuccess = service.Approve("/Shared Documents/Test2.docx", "Check-in comment for the approval."); Console.WriteLine("Approve success = " + approveSuccess); Console.Read(); } catch (ServiceException ex) { Console.WriteLine("Error: " + ex.Message); Console.WriteLine("Error: " + ex.ErrorCode); Console.WriteLine("Error: " + ex.ErrorString); Console.WriteLine("Error: " + ex.RequestUrl); Console.Read(); } catch (WebException ex) { Console.WriteLine("Error: " + ex.Message); Console.Read(); } } } }
VB example
Imports System Imports System.Net Imports Independentsoft.Share Namespace Sample Class Module1 Shared Sub Main(ByVal args As String()) Try Dim service As New Service("https://independentsoft.sharepoint.com", "username", "password") Dim publishSuccess = service.Publish("/Shared Documents/Test2.docx", "Check-in comment for the publish.") Console.WriteLine("Publish success = " & publishSuccess) Dim approveSuccess = service.Approve("/Shared Documents/Test2.docx", "Check-in comment for the approval.") Console.WriteLine("Approve success = " & approveSuccess) Console.Read() Catch ex As ServiceException Console.WriteLine("Error: " + ex.Message) Console.WriteLine("Error: " + ex.ErrorCode) Console.WriteLine("Error: " + ex.ErrorString) Console.WriteLine("Error: " + ex.RequestUrl) Console.Read() Catch ex As WebException Console.WriteLine("Error: " + ex.Message) Console.Read() End Try End Sub End Class End Namespace
Need help? Ask our developers:
Name*
Email*
Message*