Skip to content

Repository files navigation

CompuMaster.OpenCollaborationService

Github ReleaseNuGet CompuMaster.Ocs

An implementation for OpenCollaborationService (OCS) client

  • for use with e.g. OwnCloud, NextCloud
  • for .NET Standard 2.0 incl. .Net Core + .Net Framework

Access and manage OwnCloud and NextCloud servers through WebDAV and the OwnCloud/NextCloud OCS API

Project status

Current code base has been tested to work on:

  • OwnCloud 10
  • NextCloud 23

Instructions

The project is a .Net Standard 2.0 class library and it should work on .Net and Mono/Xamarin.

Sample Code

OCS API: Sharing and management

staticvoidShowLoggedInEnvironment(){OcsClientc=newOcsClient("serverurl","username","password");System.Console.WriteLine("## Instance");System.Console.WriteLine("BaseUrl="+c.BaseUrl);System.Console.WriteLine("WebDavBaseUrl="+c.WebDavBaseUrl);System.Console.WriteLine();System.Console.WriteLine("## User");System.Console.WriteLine(c.AuthorizedUserID);System.Console.WriteLine();System.Console.WriteLine("## Config");System.Console.WriteLine("website="+c.GetConfig().Website);System.Console.WriteLine("Host="+c.GetConfig().Host);System.Console.WriteLine("Ssl="+c.GetConfig().Ssl);System.Console.WriteLine("Contact="+c.GetConfig().Contact);System.Console.WriteLine("Version="+c.GetConfig().Version);}staticvoidShowLoggedInUserInfo(){OcsClientc=newOcsClient("serverurl","username","password");varuser=c.GetUserAttributes("username");System.Console.WriteLine("EMail="+user.EMail);System.Console.WriteLine("DisplayName="+user.DisplayName);System.Console.WriteLine("Enabled="+user.Enabled);System.Console.WriteLine("Quota.Total="+user.Quota.Total);System.Console.WriteLine("Quota.Used="+user.Quota.Used);System.Console.WriteLine("Quota.Free="+user.Quota.Free);System.Console.WriteLine("Quota.Relative="+user.Quota.Relative);}

WebDAV access

usingSystem.IO;usingSystem.Reflection;namespaceCompuMaster.Ocs.DemoApp{classProgram{staticvoidMain(string[]args){stringpath=Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);varc=newOcsClient("https://cloud.server/","uploaduser","uploadpassword");varde=c.Download("/5K_Wallpaper_9.png");using(varfileStream=newFileStream(path+"\\5K_Wallpaper_9.png",FileMode.Create,FileAccess.Write)){de.CopyTo(fileStream);}Streamfs=File.OpenRead(path+"\\5K_Wallpaper_9.png");c.Upload("/Zafer.png",fs);varps=c.ShareWithLink("/Zafer.png");}}}

Many thanks to the contributors

About

An implementation for OpenCollaborationService (OCS) client for use with e.g. OwnCloud, NextCloud

Resources

Stars

12 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages