This topic describes how to install .NET SDK and provides an operation example.

Installation

To download .NET SDK, click .NET SDK.

Note RAM is available on the NuGet platform. For more infomation, see RAM NuGet.

Example

The following is an example of how to create a RAM user by using .NET SDK:

using System;
using Aliyun.Acs.Core;
using Aliyun.Acs.Core.Profile;
using Aliyun.Acs.Ram.Model.V20150501;

namespace ram_net_sdk_sample
{
    class Program
    {
        static void Main(string[] args)
        {
            // Construct an Alibaba Cloud client to initiate a request.
            // Set the access key ID and access key secret.
            // Alibaba Cloud Resource Access Management (RAM) is a global service. Its API endpoint is China (Hangzhou). Here, set "Region" to "cn-hangzhou".
            IClientProfile profile = DefaultProfile.GetProfile("cn-hangzhou", "<access-key-id>", "<access-key-secret>");
            DefaultAcsClient client = new DefaultAcsClient(profile);


            // Construct the "CreateUser" request.
            CreateUserRequest request = new CreateUserRequest();

            // Set the "UserName" parameter.
            request.UserName = "alice";

            // Initiate a request and obtain a response.
            try
            {
                CreateUserResponse response = client.GetAcsResponse(request);

                Console.WriteLine("UserName: " + response.User.UserName);
                Console.WriteLine("CreateTime: " + response.User.CreateDate);
            }
            catch (Exception ex)
            {
                Console.Write(ex.ToString());
            }
            Console.ReadLine();
        }

    }
}