-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathdescription.html
240 lines (220 loc) · 13.4 KB
/
description.html
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head><link rel="stylesheet" type="text/css" href="description/Combined.css,0:sprite;/Areas/Epx/Themes/Windows/Content:0&amp;hashKey=15EDE1F25211E852032D2691D5FEB7B8" xmlns="http://www.w3.org/1999/xhtml" />
<link rel="stylesheet" type="text/css" href="description/9d0720cf-bf50-484c-bf6c-77cf57a10f7cCombined.css,0:sprite,1:LinkList;/Areas/Epx/Themes/Windows/Content:0,/Areas/Epx/Themes/Base/Content:1&amp;hashKey=52ADCBE5376E50AE6798D3D038D063E9" xmlns="http://www.w3.org/1999/xhtml" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Sending email notification with Windows Azure Mobile Services</title>
<link href="description/Galleries.css" type="text/css" rel="Stylesheet" /><link href="description/Layout.css" type="text/css" rel="Stylesheet" /><link href="description/Brand.css" type="text/css" rel="Stylesheet" /><link href="description/f1d4cd5b-ee0e-41ab-9a4f-a8fc36768c28Brand.css" type="text/css" rel="Stylesheet" />
<link href="description/iframedescription.css" rel="Stylesheet" type="text/css" />
<script src="description/offline.js" type="text/javascript"></script>
<style type="text/css">
#projectInfo {
overflow: auto;
}
#longDesc {
clear:both;
margin: 25px 0 10px 0;
}
#SampleIndexList{
margin-left: 15px;
}
</style>
</head>
<body>
<div id="offlineDescription">
<h1>Sending email notification with Windows Azure Mobile Services</h1>
<br/>
<div id="projectInfo">
<div class="section">
<div class="itemBarLong tagsContainer">
<label for="Technologies">Technologies</label>
<div id="Technologies">
Windows Runtime
</div>
</div>
<div class="itemBarLong tagsContainer">
<label for="Topics">Topics</label>
<div id="Topics">
azure mobile services
</div>
</div>
<div class="itemBarLong">
<label for="Platforms">Platforms</label>
<div id="Platforms">
Windows RT
</div>
</div>
<div class="itemBarLong">
<label for="Requirements">Requirements</label>
<div id="Requirements">
</div>
</div>
<div class="itemBar">
<label for="LastUpdated">Primary language</label>
<div id="LastUpdated">en-US</div>
</div>
<div class="itemBar">
<label for="LastUpdated">Updated</label>
<div id="LastUpdated">11/25/2013</div>
</div>
<div class="itemBarLong">
<label for="License">License</label>
<div id="License">
<a href="license.rtf">MS-LPL</a></div>
</div>
<div class="itemBar">
<div class="viewonlinecont">
<a data-link="online" href="http://code.msdn.microsoft.com/windowsapps/Sending-email-notification-da7a9d15">View this sample online</a>
</div>
</div>
</div>
</div>
<script type="text/javascript">
function initializePage() {
var otherTabClass = 'otherTab';
var hiddenPreClass = 'hidden';
var htmlDecode = function(encodedData) {
var decodedData = "";
if (encodedData) {
var div = document.createElement('div');
div.innerHTML = encodedData;
decodedData = div.firstChild.nodeValue.replace( /\\r\\n/ig , '\r\n');
}
return decodedData;
};
Galleries.iterateElem(Galleries.findElem(null, 'div', 'scriptcode'), function (index, scriptBlock) {
var titleElem = Galleries.findElem(scriptBlock, 'div', 'title')[0];
var labelElems = Galleries.findElem(titleElem, 'span');
if (labelElems.length == 0) {
labelElems = titleElem;
}
var languageSpans = Galleries.findElem(scriptBlock, 'span', 'hidden');
var pres = Galleries.findElem(scriptBlock, 'pre');
if (languageSpans.length > 0 && pres.length > 1) {
Galleries.iterateElem(labelElems, function(index, elem) {
var codePre = pres[index];
var labelSpan = elem;
var languageSpan = languageSpans[index];
elem.code = codePre.innerHTML.replace( /(\r(\n)?)|((\r)?\n)/ig , '\\r\\n');
codePre.className = codePre.className.replace(hiddenPreClass, '');
languageSpan.parentNode.removeChild(languageSpan);
});
pres = Galleries.findElem(scriptBlock, 'pre');
Galleries.iterateElem(labelElems, function(index, elem) {
var codePre = pres[index];
var labelSpan = elem;
if (index == 0) {
scriptBlock.activeTab = 0;
}
else {
labelSpan.className += otherTabClass;
codePre.className += hiddenPreClass;
}
Galleries.attachEventHandler(labelSpan, 'click', function(e) {
var activeTab = scriptBlock.activeTab;
labelElems[activeTab].className += otherTabClass;
pres[activeTab].className += hiddenPreClass;
codePre.className = codePre.className.replace(hiddenPreClass, '');
labelSpan.className = labelSpan.className.replace(otherTabClass, '');
scriptBlock.activeTab = index;
});
});
var preview = Galleries.findElem(scriptBlock, 'div', 'preview');
if (preview.length == 0) {
preview.push(pres[pres.length - 1]);
}
Galleries.iterateElem(preview, function(index, elem) {
elem.parentNode.removeChild(elem);
});
if (window.clipboardData && clipboardData.setData) {
var copyLink = document.createElement('a');
copyLink.href = 'javascript:void(0);';
copyLink.className = 'copyCode';
copyLink.innerHTML = 'Copy code';
Galleries.attachEventHandler(copyLink, 'click', function (e) {
clipboardData.setData("Text", htmlDecode(labelElems[scriptBlock.activeTab].code));
return false;
});
scriptBlock.insertBefore(copyLink, scriptBlock.childNodes[0]);
}
}
});
}
Galleries.onWindowLoad(function(){
initializePage();
});
</script>
<div id="longDesc">
<div id="mainSection">
<p>This sample shows how Windows Azure Mobile Services enables you to send email notifications.
</p>
<p>This Windows Store app demonstrates a feedback charm that users can use to submit feedback about the app. After the user submits the feedback, it is sent to a Mobile Services table and is stored there for future analysis. After the feedback is received and
stored, Mobile Services sends an email notification to a predetermined email account.</p>
<p>To obtain an evaluation copy of Windows 8.1, go to <a href="http://go.microsoft.com/fwlink/p/?linkid=301696">
Windows 8.1</a>.</p>
<p>To obtain an evaluation copy of Microsoft Visual Studio 2013, go to <a href="http://go.microsoft.com/fwlink/p/?linkid=301697">
Visual Studio 2013</a>.</p>
<p></p>
<p class="note"><b>Note</b> For Windows 8 app samples, download the <a href="http://go.microsoft.com/fwlink/p/?LinkId=301698">
Windows 8 app samples pack</a>. The samples in the Windows 8 app samples pack will build and run only on Microsoft Visual Studio 2012.</p>
<p></p>
<h2><a id="related_topics"></a>Related topics</h2>
<dl><dt><a href="http://go.microsoft.com/fwlink/p/?LinkId=308983">free Windows Azure trial</a>
</dt><dt><a href="http://go.microsoft.com/fwlink/p/?LinkId=306800">Send email from Mobile Services with SendGrid</a>
</dt><dt><a href="http://go.microsoft.com/fwlink/p/?LinkId=306779">Windows Azure management portal</a>
</dt><dt><a href="http://go.microsoft.com/fwlink/p/?LinkID=227694">Windows app samples</a>
</dt></dl>
<h2>Operating system requirements</h2>
<table>
<tbody>
<tr>
<th>Client</th>
<td><dt>Windows 8.1 </dt></td>
</tr>
<tr>
<th>Server</th>
<td><dt>Windows Server 2012 R2 </dt></td>
</tr>
</tbody>
</table>
<h2>Build the sample</h2>
<ol>
<li>If you do not have a Windows Azure subscription, sign up for a <a href="http://go.microsoft.com/fwlink/p/?LinkId=308983">
free Windows Azure trial</a>. </li><li>Install the <a href="http://go.microsoft.com/fwlink/p/?LinkID=275464">Windows Azure command line tools</a>.
</li><li>Open a command prompt to download the required credentials to communicate with Windows Azure as follows. This is a one-time setup for running all subsequent commands to manage Mobile Services:
<ol>
<li>Download Windows Azure management credentials with this command: <code>azure account download</code>. This will display a web page for you to sign in to the
<a href="http://go.microsoft.com/fwlink/p/?LinkId=306779">Windows Azure management portal</a>. After you sign in, Windows Azure will prompt you to download a publish settings file for your Windows Azure subscription. Save this file to your local computer.
</li><li>Import the publish settings file from this location with this command: <code>
azure account import</code> <i>[SavedLocation]</i>. This will configure your command prompt to manage all of your Windows Azure services from the command line.
</li></ol>
</li><li>Create a Windows Azure Mobile Service with this command: <code>azure mobile create</code> <i>[AzureMobileServiceName] [sqlAdminUsername] [sqlAdminPassword]</i>
</li><li>Create a <code>Feedback</code> table to store all the feedback obtained from the app users, with this command:
<code>azure mobile table create</code> <i>[AzureMobileServiceName]</i> <code>Feedback</code>
</li><li>Go to <a href="http://go.microsoft.com/fwlink/p/?LinkId=306800">Send email from Mobile Services with SendGrid</a> and follow the instructions to create a
<code>SendGrid</code> account. Make note of the account's user name and password.
</li><li>Upload a script to your Windows Azure Mobile Service that will send the feedback in email as it is received from the user:
<ol>
<li>From a command line, change to the sample's <code>Scripts</code> directory. </li><li>Open <code>feedback.insert.js</code> in the <code>Table</code> folder and replace "{username}" with the SendGrid user name, "{password}" with the SendGrid password, and "{email-address}" with the email address that you want to email the received feedback
to. </li><li>Run this command: <code>azure mobile script upload</code> <i>[AzureMobileServiceName]</i> <code>table/feedback.insert.js</code>
</li></ol>
</li><li>Get the <code>ApplicationUrl</code> and <code>ApplicationKey</code> for your Windows Azure Mobile Service with this command:
<code>azure mobile show</code> <i>[AzureMobileServiceName]</i> </li><li>Install the <a href="http://go.microsoft.com/fwlink/p/?LinkID=320478">Windows Azure Mobile Services NuGet package</a>.
</li><li>Open the <code>App.xaml.cs</code> file and replace "mobile-service-url" and "mobile-service-key" with the
<code>ApplicationUrl</code> and <code>ApplicationKey</code>. Your Windows Store app is now configured to communicate with your created Windows Azure Mobile Service.
</li><li>Click <b>Build</b> > <b>Build Solution</b>. </li></ol>
<h2>Run the sample</h2>
<ol>
<li>To debug the app and then run it in Microsoft Visual Studio, press F5 or use <b>
Debug</b> > <b>Start Debugging</b>. To run the app without debugging, press Ctrl+F5 or use
<b>Debug</b> > <b>Start Without Debugging</b>. </li><li>After the app starts, move your mouse to the top right corner and then click <b>
Feedback</b>. Type some text and click <b>Send Feeback</b>. This sends the feedback to your Windows Azure Mobile Service and adds it as a row to the
<code>Feedback</code> table. It then send an email by using <code>SendGrid</code> and running the script that you uploaded.
</li><li>You can also go to the <a href="http://go.microsoft.com/fwlink/p/?LinkId=306779">
Windows Azure management portal</a>, sign in, and view your Windows Azure Mobile Service and the saved data.
</li></ol>
</div>
</div>
</div>
</body>
</html>