3 simple steps to start using Aspose.Cloud Storage
Tags: csharp, pdf, beginners, tutorial
Published: 2018-05-15 16:31:27

---
title: 3 simple steps to start using Aspose.Cloud Storage
published: true
description: Aspose.Cloud Storage is a component of Aspose.Cloud platform, which releases a transparent interface for access to different sources. 
tags: csharp, pdf, beginners, tutorial
---
Solving the problems of document processing, we often encounter the problem of getting source documents from different sources and from different providers. Aspose.Cloud Storage is a component of Aspose.Cloud platform, which releases a transparent interface for access to different sources. Now Aspose.Cloud Storage supports popular services from Amazon, Dropbox, Google, Microsoft. Let's see how we can use this component.

#Step 1: Create an Aspose.Cloud account

* We can create a free Aspose.Cloud account using the link "Create a new Account" on    http://dashboard.aspose.cloud or sign in with GitHub or Google Account.

![SignIn/SignUp Form](https://thepracticaldev.s3.amazonaws.com/i/a2ki83dnqhvxa06zrbda.PNG)
* When registering, for each account an Aspose.Cloud Storage is created. We add another storage later, and now we are trying to access the current storage using C#. To do this we need to get an application credential.

#Step 2: Get an Application credentials
Aspose.Cloud Application allows us to manage access to Cloud API. By default, each account has one application named "First App". Using the "My Apps" tab, we can see the list of all applications, change settings or get the credential.

![My Apps](https://thepracticaldev.s3.amazonaws.com/i/0mwp4utpbn6x671tozg9.PNG)

The application credentials (App SID/App Key) are placed directly on the "First App" tile, but if you want to change the settings of the "First App", just click on tile heading. for testing purposes, we have enough default settings, so we will proceed to the next step, writing the client application. In this example, we will use a "Console Application" template in Microsoft Visual Studio 2017. 

#Step 3: Create a Client application 
To demonstrate the main concept of the cloud storage working, we will write an application that will synchronize certain local folder with a cloud folder with the same name. So, let's start.
1. Create a console application (in VS2017 File->New->Project>Windows Classic Desktop->Console App);
1. Install Aspose.Storage for Cloud SDK (in Package Manager Console: `Install-Package Aspose.Storage-Cloud`)
![Install Aspose.Storage for Cloud SDK](https://thepracticaldev.s3.amazonaws.com/i/9ilru3qtv2tcr6rm3um5.PNG)

##Step 3a: Setup an API client
To be able making API requests, we must initialize an API client. It's pretty straightforward: declare `StorageApi` object and initialize it with `AppKey` and `AppSID`. 
{% gist https://gist.github.com/andruhovski/ed837cf7b28bd723c48a4f70fba31923 %}

##Step 3b: Write own code using API client
This part of our example will show the usage of most frequent API requests:
* Check if a file exists
* Create a folder
* Get a list of files
* Create (upload) file to cloud storage

It is worth noting, that all `StorageApi` methods accept a *request* object and returns a *response* object. All *response* objects have common properties such us `Code` and `Status` and we can use there to check if API call was successful.

According to our problem, we need to synchronize certain local folder with a cloud folder with the same name. So first, we must ensure that the cloud folder exists,  otherwise create one. Storage API provides `GetIsExist` and `PutCreateFolder`.
Thus, checking if the cloud folder would look like this:

{% gist https://gist.github.com/andruhovski/76bf1d34e9a8aeba051bbcbfaf13963b %}

Next step, we prepare a file list for upload. What will we do? It's easy: we need to get a list of all files from the local folder and a list of files in the cloud. The [difference](https://en.wikipedia.org/wiki/Complement_(set_theory)) of these lists give us a list of files need to upload.

Finally, we will call `PutCreateDocument` the loop through the resultant list.

{% gist https://gist.github.com/andruhovski/3062f6f3cefbb9aa6e73fb6bffeec177 %}

#Conclusion
- Q: Is it one-way synchronizer? 
- A: Yes. It showed the main ways of usage Aspose.Cloud Storage, and you can improve it yourself.
- Q: And what about other storages?
- A: Learn more in the article ["How to Configure 3rd Party Cloud Storages"](https://docs.aspose.cloud/display/storagecloud/How+to+Configure+3rd+Party+Cloud+Storages).
- Q: What's next?
- A: In the next posts, we will continue to deal with the Aspose.Cloud features.