Note: This code example does not work at this time, and is preserved here for archival purposes. We apologize for the inconvenience.
We are collaborating with the OpenStack project on a newer .NET SDK that would work with Cloud Files. You can track its progress on its github project page.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using com.mosso.cloudfiles;
using com.mosso.cloudfiles.domain;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
UserCredentials userCreds = new UserCredentials("UserNameGoesHere", "ApiKeyGoesHere");
Connection connection = new com.mosso.cloudfiles.Connection(userCreds);
connection.CreateContainer("ContainerNameGoesHere");
connection.PutStorageItem("ContainerNameGoesHere", "PathToFileYouWantToUpload");
}
}
}
© 2011-2013 Rackspace US, Inc.
Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License

16 Comments
outdated code
re: code examples
code updated?
re: code sample
Powershell
VB.net for Cloud Files
re: vb.net
https://github.com/rackspace/
Update
re: code sample
GitHub
using System;
using Rackspace.Cloudfiles;
namespace cloudfiles
{
class Program
{
private const string ContainerName = "testing";
public static void Main(string[] args)
{
var creds = new UserCredentials("USERNAME","APIKEY");
var client = new CF_Client();
Connection conn = new CF_Connection(creds, client);
Console.WriteLine("Authenticating...");
conn.Authenticate();
Console.WriteLine("Authenticated");
var container = new CF_Container(conn, client, ContainerName);
var list = container.GetObjectList(true);
Console.WriteLine("There are {0} items in the {1} container", list.Count, ContainerName);
Console.WriteLine("Listing all objects in {0} container", ContainerName);
foreach(var item in list) {
Console.WriteLine(item["name"]);
Console.WriteLine("--------------------");
}
Console.WriteLine("Listed all objects in {0} container", ContainerName);
Console.ReadLine();
}
}
}
Note that you need to add references to both the Rackspace.Cloudfiles and OpenStack.Swift dlls.
How to use "ProxyCredentials"!
UserCredentials userCredentials = new UserCredentials(new System.Uri(auth_endpoint), username, api_access_key, null, null);
On live landscape it works fine.
How to use "ProxyCredentials"!
UserCredentials userCredentials = new UserCredentials(new System.Uri(auth_endpoint), username, api_access_key, null, null);
On live landscape where there is no need for proxy it works fine.
re: ProxyCredentials
https://github.com/rackspace/openstack.net/
Does anyone know where the
re: Objective-C
https://github.com/rackerlabs
You should be able to find the iOS Cloudfiles bindings here:
https://github.com/rackerlabs/ios-cloudfiles
RE: VB.NET
I'm still writing documentation but it should be pretty easy to use...
https://github.com/LukeBaum/CloudFilesHelper
Add new comment