-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
43 lines (36 loc) · 1.36 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
using Microsoft.Azure;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Queue;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
namespace StorageAccountOperations
{
class Programd
{
static void Main(string[] args)
{
// Retrieve storage account from connection string.
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting("StorageConnectionString"));
// Create the queue client.
CloudQueueClient queueClient = storageAccount.CreateCloudQueueClient();
// Retrieve a reference to a queue.
CloudQueue queue = queueClient.GetQueueReference("queue");
// Create the queue if it doesn't already exist.
queue.CreateIfNotExists();
ActionDescription sendMailTo = new ActionDescription { Id = 3, Email = "[email protected]"};
// Create a message and add it to the queue.
CloudQueueMessage jsonMessage = new CloudQueueMessage(JsonConvert.SerializeObject(sendMailTo));
queue.AddMessage(jsonMessage);
}
}
internal class ActionDescription
{
public int Id { get; set; }
public string Email { get; set; }
}
}