←Select platform

Credentials Property

Summary
Gets or sets the credentials for this SharePointClient object.

Syntax
C#
C++/CLI
Python
public ICredentials Credentials { get; set; } 
public: 
property ICredentials^ Credentials { 
   ICredentials^ get(); 
   void set (    ICredentials^ ); 
} 
Credentials # get and set (SharePointClient) 

Property Value

The credentials for this SharePointClient object. The default value is null (Nothing in VB).

Remarks

The Credentials object must be either a System.Net.NetworkCredential or a System.Net.CredentialCache object.

Example
C#
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.ImageProcessing; 
using Leadtools.ImageProcessing.Color; 
using Leadtools.SharePoint.Client; 
 
 
public void SharePointClientExample() 
{ 
   // Replace SHAREPOINT_SITE_URI with a valid URL to a SharePoint site, for example 
   // http://SiteCollection/MySite 
   Uri siteUri = new Uri(SHAREPOINT_SITE_URI); 
 
   // Replace SHAREPOINT_FOLDER_NAME with a valid folder on the site above, for example 
   // "Documents" or "Documents\Sub Documents" 
   string folderName = SHAREPOINT_FOLDER_NAME; 
 
   // Replace SHAREPOINT_DOCUMENT_NAME with a valid document on the folder above, for example 
   // MyDocument.tif 
   string documentName = SHAREPOINT_DOCUMENT_NAME; 
 
   // Build the full URL to the document are we going to download 
   UriBuilder builder = new UriBuilder(siteUri); 
   builder.Path = Path.Combine(builder.Path, folderName); 
   builder.Path = Path.Combine(builder.Path, documentName); 
   Uri sourceDocumentUri = builder.Uri; 
 
   SharePointClient spClient = new SharePointClient(); 
 
   // Optional: Set the credentials: 
   if (USER_NAME != null) 
   { 
      spClient.Credentials = new NetworkCredential(USER_NAME, PASSWORD, DOMAIN); 
   } 
 
   // Optional: If you must use a Proxy server to connect to SharePoint, set it up: 
   if (PROXY_HOST != null) 
   { 
      WebProxy proxy = new WebProxy(PROXY_HOST, PROXY_PORT); 
      spClient.Proxy = proxy; 
   } 
 
   string tempFileName = Path.GetTempFileName(); 
   try 
   { 
      // Download the SharePoint item to the temporary file 
      Console.WriteLine("Downloading {0}", sourceDocumentUri); 
      spClient.DownloadFile(sourceDocumentUri, tempFileName); 
 
      // Load the image 
      using (RasterCodecs codecs = new RasterCodecs()) 
      { 
         using (RasterImage image = codecs.Load(tempFileName)) 
         { 
            // Invert it 
            Console.WriteLine("Inverting"); 
            new InvertCommand().Run(image); 
 
            // Save it back to the same file 
            Console.WriteLine("Saving back to disk"); 
            codecs.Save(image, tempFileName, image.OriginalFormat, image.BitsPerPixel); 
         } 
      } 
 
      // Upload the file back with a new name (OriginalName_Inverted.ext) 
      string name = Path.GetFileNameWithoutExtension(documentName); 
      string ext = Path.GetExtension(documentName); 
 
      name = name + "_Inverted"; 
      name = Path.ChangeExtension(name, ext); 
 
      // Get the destination path (destination folder + file name) 
      string destinationPath = Path.Combine(folderName, name); 
 
      Console.WriteLine("Uploading to {0}", destinationPath); 
      // Make sure to overwrite the file if it already exists 
      spClient.OverwriteExistingFiles = true; 
      spClient.UploadFile(tempFileName, siteUri, destinationPath); 
   } 
   finally 
   { 
      // Delete the temporary file 
      File.Delete(tempFileName); 
   } 
} 
Requirements

Target Platforms

Help Version 22.0.2023.3.31
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.