Skip to content
This repository was archived by the owner on Nov 16, 2023. It is now read-only.

Commit 2813883

Browse files
author
Jim Crowley
committed
Adding Excel snippets
1 parent cef5472 commit 2813883

File tree

8 files changed

+915
-72
lines changed

8 files changed

+915
-72
lines changed

Microsoft-Graph-Snippets-SDK/Assets/Resources.resw

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,15 @@
120120
<data name="AddMember" xml:space="preserve">
121121
<value>Add member</value>
122122
</data>
123+
<data name="AddXLTable" xml:space="preserve">
124+
<value>Used Range</value>
125+
</data>
126+
<data name="AddXLTableRow" xml:space="preserve">
127+
<value>Add Table Row</value>
128+
</data>
129+
<data name="ChangeXLNumFormat" xml:space="preserve">
130+
<value>Number Format</value>
131+
</data>
123132
<data name="ClearSelected" xml:space="preserve">
124133
<value>clear selection</value>
125134
</data>
@@ -138,6 +147,9 @@
138147
<data name="CreateUser" xml:space="preserve">
139148
<value>Create User</value>
140149
</data>
150+
<data name="CreateXLChart" xml:space="preserve">
151+
<value>Create XL Chart</value>
152+
</data>
141153
<data name="DeleteEvent" xml:space="preserve">
142154
<value>Delete Event</value>
143155
</data>
@@ -147,12 +159,21 @@
147159
<data name="DeleteGroup" xml:space="preserve">
148160
<value>Delete Group</value>
149161
</data>
162+
<data name="DeleteXLFile" xml:space="preserve">
163+
<value>Delete File</value>
164+
</data>
150165
<data name="Disconnect" xml:space="preserve">
151166
<value>disconnect</value>
152167
</data>
153168
<data name="DownloadFile" xml:space="preserve">
154169
<value>Download File</value>
155170
</data>
171+
<data name="ExcelGroup" xml:space="preserve">
172+
<value>Excel snippets (work accounts only)</value>
173+
</data>
174+
<data name="FilterXLTable" xml:space="preserve">
175+
<value>Filter Table</value>
176+
</data>
156177
<data name="GetAGroup" xml:space="preserve">
157178
<value>Get a Group</value>
158179
</data>
@@ -192,6 +213,9 @@
192213
<data name="GetUserGroups" xml:space="preserve">
193214
<value>Get User Groups</value>
194215
</data>
216+
<data name="GetXLRange" xml:space="preserve">
217+
<value>Get Range</value>
218+
</data>
195219
<data name="GroupsGroup" xml:space="preserve">
196220
<value>Groups</value>
197221
</data>
@@ -201,6 +225,9 @@
201225
<data name="PleaseRegister" xml:space="preserve">
202226
<value>Please register your app before you run this sample</value>
203227
</data>
228+
<data name="ProtectWorksheet" xml:space="preserve">
229+
<value>Protect Wksht</value>
230+
</data>
204231
<data name="ReadUsers" xml:space="preserve">
205232
<value>Read Users</value>
206233
</data>
@@ -213,6 +240,15 @@
213240
<data name="SendMessage" xml:space="preserve">
214241
<value>Send Message</value>
215242
</data>
243+
<data name="SetXLFormula" xml:space="preserve">
244+
<value>Set Formula</value>
245+
</data>
246+
<data name="SortXLTable" xml:space="preserve">
247+
<value>Sort Table</value>
248+
</data>
249+
<data name="UnprotectWorksheet" xml:space="preserve">
250+
<value>Unprotect Wksht</value>
251+
</data>
216252
<data name="UpdateEvent" xml:space="preserve">
217253
<value>Update Event</value>
218254
</data>
@@ -222,6 +258,12 @@
222258
<data name="UpdateGroup" xml:space="preserve">
223259
<value>Update Group</value>
224260
</data>
261+
<data name="UpdateXLRange" xml:space="preserve">
262+
<value>Update Range</value>
263+
</data>
264+
<data name="UploadXLFile" xml:space="preserve">
265+
<value>Upload File</value>
266+
</data>
225267
<data name="UsersGroup" xml:space="preserve">
226268
<value>Users</value>
227269
</data>
@@ -231,4 +273,7 @@
231273
<data name="WorkAdminAccess" xml:space="preserve">
232274
<value>Applicable to work accounts with admin rights</value>
233275
</data>
276+
<data name="XLABSFunction" xml:space="preserve">
277+
<value>ABS Func</value>
278+
</data>
234279
</root>

Microsoft-Graph-Snippets-SDK/MainPage.xaml.cs

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public sealed partial class MainPage : Page
3535
public string ScopeGroupAll = ResourceLoader.GetForCurrentView().GetString("PersonalWorkAccess");
3636
public string ScopeGroupWork = ResourceLoader.GetForCurrentView().GetString("WorkAccess");
3737
public string ScopeGroupWorkAdmin = ResourceLoader.GetForCurrentView().GetString("WorkAdminAccess");
38+
public string ScopeGroupExcel = ResourceLoader.GetForCurrentView().GetString("ExcelGroup");
3839

3940
public List<StoryDefinition> StoryCollection { get; private set; }
4041
public MainPage()
@@ -92,7 +93,6 @@ private void CreateStoryList()
9293
StoryCollection.Add(new StoryDefinition() { GroupName = usersGroupName, Title = ResourceLoader.GetForCurrentView().GetString("GetDirects"), ScopeGroup = ScopeGroupWork, RunStoryAsync = UserStories.TryGetDirectReportsAsync });
9394
StoryCollection.Add(new StoryDefinition() { GroupName = usersGroupName, Title = ResourceLoader.GetForCurrentView().GetString("GetPhoto"), ScopeGroup = ScopeGroupWork, RunStoryAsync = UserStories.TryGetCurrentUserPhotoAsync });
9495

95-
9696
// Stories applicable only to work or school accounts with admin access
9797
// NOTE: All of these snippets will fail for lack of permissions if you sign into the sample with a non-admin work account
9898
// or any consumer account.
@@ -108,6 +108,27 @@ private void CreateStoryList()
108108
StoryCollection.Add(new StoryDefinition() { GroupName = groupsGroupName, Title = ResourceLoader.GetForCurrentView().GetString("DeleteGroup"), ScopeGroup = ScopeGroupWorkAdmin, RunStoryAsync = GroupStories.TryDeleteGroupAsync });
109109
StoryCollection.Add(new StoryDefinition() { GroupName = groupsGroupName, Title = ResourceLoader.GetForCurrentView().GetString("AddMember"), ScopeGroup = ScopeGroupWorkAdmin, RunStoryAsync = GroupStories.TryAddUserToGroup });
110110

111+
// Excel snippets. These stories are applicable only to work or school accounts.
112+
// NOTE: All of these snippets will fail for lack of permissions if you sign into the sample with a personal (consumer) account
113+
114+
StoryCollection.Add(new StoryDefinition() { GroupName = usersGroupName, Title = ResourceLoader.GetForCurrentView().GetString("UploadXLFile"), ScopeGroup = ScopeGroupExcel, RunStoryAsync = UserStories.TryUploadExcelFileAsync });
115+
116+
StoryCollection.Add(new StoryDefinition() { GroupName = usersGroupName, Title = ResourceLoader.GetForCurrentView().GetString("CreateXLChart"), ScopeGroup = ScopeGroupExcel, RunStoryAsync = UserStories.TryCreateExcelChartFromTableAsync });
117+
StoryCollection.Add(new StoryDefinition() { GroupName = usersGroupName, Title = ResourceLoader.GetForCurrentView().GetString("GetXLRange"), ScopeGroup = ScopeGroupExcel, RunStoryAsync = UserStories.TryGetExcelRangeAsync });
118+
StoryCollection.Add(new StoryDefinition() { GroupName = usersGroupName, Title = ResourceLoader.GetForCurrentView().GetString("UpdateXLRange"), ScopeGroup = ScopeGroupExcel, RunStoryAsync = UserStories.TryUpdateExcelRangeAsync });
119+
StoryCollection.Add(new StoryDefinition() { GroupName = usersGroupName, Title = ResourceLoader.GetForCurrentView().GetString("ChangeXLNumFormat"), ScopeGroup = ScopeGroupExcel, RunStoryAsync = UserStories.TryChangeExcelNumberFormatAsync });
120+
StoryCollection.Add(new StoryDefinition() { GroupName = usersGroupName, Title = ResourceLoader.GetForCurrentView().GetString("XLABSFunction"), ScopeGroup = ScopeGroupExcel, RunStoryAsync = UserStories.TryAbsExcelFunctionAsync });
121+
StoryCollection.Add(new StoryDefinition() { GroupName = usersGroupName, Title = ResourceLoader.GetForCurrentView().GetString("SetXLFormula"), ScopeGroup = ScopeGroupExcel, RunStoryAsync = UserStories.TrySetExcelFormulaAsync });
122+
StoryCollection.Add(new StoryDefinition() { GroupName = usersGroupName, Title = ResourceLoader.GetForCurrentView().GetString("AddXLTable"), ScopeGroup = ScopeGroupExcel, RunStoryAsync = UserStories.TryAddExcelTableToUsedRangeAsync });
123+
StoryCollection.Add(new StoryDefinition() { GroupName = usersGroupName, Title = ResourceLoader.GetForCurrentView().GetString("AddXLTableRow"), ScopeGroup = ScopeGroupExcel, RunStoryAsync = UserStories.TryAddExcelRowToTableAsync });
124+
StoryCollection.Add(new StoryDefinition() { GroupName = usersGroupName, Title = ResourceLoader.GetForCurrentView().GetString("SortXLTable"), ScopeGroup = ScopeGroupExcel, RunStoryAsync = UserStories.TrySortExcelTableOnFirstColumnValueAsync });
125+
StoryCollection.Add(new StoryDefinition() { GroupName = usersGroupName, Title = ResourceLoader.GetForCurrentView().GetString("FilterXLTable"), ScopeGroup = ScopeGroupExcel, RunStoryAsync = UserStories.TryFilterExcelTableValuesAsync });
126+
StoryCollection.Add(new StoryDefinition() { GroupName = usersGroupName, Title = ResourceLoader.GetForCurrentView().GetString("ProtectWorksheet"), ScopeGroup = ScopeGroupExcel, RunStoryAsync = UserStories.TryProtectExcelWorksheetAsync });
127+
StoryCollection.Add(new StoryDefinition() { GroupName = usersGroupName, Title = ResourceLoader.GetForCurrentView().GetString("UnprotectWorksheet"), ScopeGroup = ScopeGroupExcel, RunStoryAsync = UserStories.TryUnprotectExcelWorksheetAsync });
128+
129+
StoryCollection.Add(new StoryDefinition() { GroupName = usersGroupName, Title = ResourceLoader.GetForCurrentView().GetString("DeleteXLFile"), ScopeGroup = ScopeGroupExcel, RunStoryAsync = UserStories.TryDeleteExcelFileAsync });
130+
131+
111132

112133
var result = from story in StoryCollection group story by story.ScopeGroup into api orderby api.Key select api;
113134
StoriesByApi.Source = result;

Microsoft-Graph-Snippets-SDK/Microsoft-Graph-Snippets-SDK.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@
9191
<ItemGroup>
9292
<!-- A reference to the entire .Net Framework and Windows SDK are automatically included -->
9393
<PRIResource Include="Assets\Resources.resw" />
94+
<Content Include="excelTestResource.xlsx">
95+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
96+
</Content>
9497
<None Include="project.json" />
9598
</ItemGroup>
9699
<ItemGroup>

0 commit comments

Comments
 (0)