edit-icon download-icon

Samples

Last Updated: Jul 03, 2017
  1. using System;
  2. using Aliyun.Acs.Core;
  3. using Aliyun.Acs.Core.Profile;
  4. using Aliyun.Acs.Ram.Model.V20150501;
  5. namespace ram_net_sdk_sample
  6. {
  7. class Program
  8. {
  9. static void Main(string[] args)
  10. {
  11. // Construct an Aliyun Client for initiating a request
  12. // Set AccessKeyID and AccessKeySevcret when constructing the Aliyun Client
  13. // RAM is a Global Service, and its API ingress is located in the East China 1 (Hangzhou) region. Enter "cn-hangzhou" in "Region"
  14. IClientProfile profile = DefaultProfile.GetProfile("cn-hangzhou", "<access-key-id>", "<access-key-secret>");
  15. DefaultAcsClient client = new DefaultAcsClient(profile);
  16. // Construct a "CreateUser" request
  17. CreateUserRequest request = new CreateUserRequest();
  18. //Set the parameter - UserName
  19. request.UserName = "alice";
  20. // Initiate a request and obtain the response
  21. try
  22. {
  23. CreateUserResponse response = client.GetAcsResponse(request);
  24. Console.WriteLine("UserName: " + response.User.UserName);
  25. Console.WriteLine("CreateTime: " + response.User.CreateDate);
  26. }
  27. catch (Exception ex)
  28. {
  29. Console.Write(ex.ToString());
  30. }
  31. Console.ReadLine();
  32. }
  33. }
  34. }
Thank you! We've received your feedback.