-
Notifications
You must be signed in to change notification settings - Fork 210
Expand file tree
/
Copy pathIntuneAPIs.tsx
More file actions
46 lines (40 loc) · 1.58 KB
/
Copy pathIntuneAPIs.tsx
File metadata and controls
46 lines (40 loc) · 1.58 KB
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
import { intune } from '@microsoft/teams-js';
import React, { ReactElement } from 'react';
import { ApiWithoutInput, ApiWithTextInput } from './utils';
import { ModuleWrapper } from './utils/ModuleWrapper';
const CheckIntuneCapability = (): React.ReactElement =>
ApiWithoutInput({
name: 'checkIntuneCapability',
title: 'Check Intune Capability',
onClick: async () => `Intune module ${intune.isSupported() ? 'is' : 'is not'} supported`,
});
const IsSaveToLocationAllowed = (): React.ReactElement =>
ApiWithTextInput<string>({
name: 'isSaveToLocationAllowed',
title: 'Is Save To Location Allowed',
onClick: async (input) => {
const location = input as intune.SaveLocation;
const result = await intune.isSaveToLocationAllowed(location);
return `Save to ${input}: ${result ? 'Allowed' : 'Not Allowed'}`;
},
defaultInput: JSON.stringify(intune.SaveLocation.LOCAL),
});
const IsOpenFromLocationAllowed = (): React.ReactElement =>
ApiWithTextInput<string>({
name: 'isOpenFromLocationAllowed',
title: 'Is Open From Location Allowed',
onClick: async (input) => {
const location = input as intune.OpenLocation;
const result = await intune.isOpenFromLocationAllowed(location);
return `Open from ${input}: ${result ? 'Allowed' : 'Not Allowed'}`;
},
defaultInput: JSON.stringify(intune.OpenLocation.LOCAL),
});
const IntuneAPIs = (): ReactElement => (
<ModuleWrapper title="Intune">
<CheckIntuneCapability />
<IsSaveToLocationAllowed />
<IsOpenFromLocationAllowed />
</ModuleWrapper>
);
export default IntuneAPIs;