UNPKG

17.4 kBTypeScriptView Raw
1import { IPrincipalInfo } from "../types.js";
2import { _Web } from "../webs/types.js";
3import { _File } from "../files/types.js";
4import { _Item } from "../items/types.js";
5import { _Folder } from "../folders/types.js";
6export declare type ShareableQueryable = _Web | _File | _Folder | _Item;
7/**
8 * Indicates the role of the sharing link
9 */
10export declare enum SharingRole {
11 None = 0,
12 View = 1,
13 Edit = 2,
14 Owner = 3
15}
16export declare enum SPSharedObjectType {
17 Unknown = 0,
18 File = 1,
19 Folder = 2,
20 Item = 3,
21 List = 4,
22 Web = 5,
23 Max = 6
24}
25export declare enum SharingDomainRestrictionMode {
26 None = 0,
27 AllowList = 1,
28 BlockList = 2
29}
30export declare enum SharingOperationStatusCode {
31 /**
32 * The share operation completed without errors.
33 */
34 CompletedSuccessfully = 0,
35 /**
36 * The share operation completed and generated requests for access.
37 */
38 AccessRequestsQueued = 1,
39 /**
40 * The share operation failed as there were no resolved users.
41 */
42 NoResolvedUsers = -1,
43 /**
44 * The share operation failed due to insufficient permissions.
45 */
46 AccessDenied = -2,
47 /**
48 * The share operation failed when attempting a cross site share, which is not supported.
49 */
50 CrossSiteRequestNotSupported = -3,
51 /**
52 * The sharing operation failed due to an unknown error.
53 */
54 UnknowError = -4,
55 /**
56 * The text you typed is too long. Please shorten it.
57 */
58 EmailBodyTooLong = -5,
59 /**
60 * The maximum number of unique scopes in the list has been exceeded.
61 */
62 ListUniqueScopesExceeded = -6,
63 /**
64 * The share operation failed because a sharing capability is disabled in the site.
65 */
66 CapabilityDisabled = -7,
67 /**
68 * The specified object for the share operation is not supported.
69 */
70 ObjectNotSupported = -8,
71 /**
72 * A SharePoint group cannot contain another SharePoint group.
73 */
74 NestedGroupsNotSupported = -9
75}
76export declare enum SharingLinkKind {
77 /**
78 * Uninitialized link
79 */
80 Uninitialized = 0,
81 /**
82 * Direct link to the object being shared
83 */
84 Direct = 1,
85 /**
86 * Organization-shareable link to the object being shared with view permissions
87 */
88 OrganizationView = 2,
89 /**
90 * Organization-shareable link to the object being shared with edit permissions
91 */
92 OrganizationEdit = 3,
93 /**
94 * View only anonymous link
95 */
96 AnonymousView = 4,
97 /**
98 * Read/Write anonymous link
99 */
100 AnonymousEdit = 5,
101 /**
102 * Flexible sharing Link where properties can change without affecting link URL
103 */
104 Flexible = 6
105}
106export interface ISharedFuncs {
107 /**
108 * Gets a link suitable for sharing for this item
109 *
110 * @param kind The type of link to share
111 * @param expiration The optional expiration date
112 */
113 getShareLink(kind: SharingLinkKind, expiration?: Date): Promise<IShareLinkResponse>;
114 /**
115 * Checks Permissions on the list of Users and returns back role the users have on the Item.
116 *
117 * @param recipients The array of Entities for which Permissions need to be checked.
118 */
119 checkSharingPermissions(recipients: ISharingRecipient[]): Promise<ISharingEntityPermission[]>;
120 /**
121 * Get Sharing Information.
122 *
123 * @param request The SharingInformationRequest Object.
124 * @param expands Expand more fields.
125 * @param selects Used to select only specific fields
126 *
127 */
128 getSharingInformation(request?: Partial<ISharingInformationRequest>, expands?: string[], selects?: string[]): Promise<ISharingInformation>;
129 /**
130 * Gets the sharing settings of an item.
131 *
132 * @param useSimplifiedRoles Determines whether to use simplified roles.
133 */
134 getObjectSharingSettings(useSimplifiedRoles?: boolean): Promise<IObjectSharingSettings>;
135 /**
136 * Unshare this item
137 */
138 unshare(): Promise<ISharingResult>;
139 /**
140 * Deletes a sharing link by kind
141 *
142 * @param kind Deletes a sharing link by the kind of link
143 */
144 deleteSharingLinkByKind(kind: SharingLinkKind): Promise<void>;
145 /**
146 * Removes the specified link to the item.
147 *
148 * @param kind The kind of link to be deleted.
149 * @param shareId
150 */
151 unshareLink(kind: SharingLinkKind, shareId?: string): Promise<void>;
152}
153export interface IShareObjectOptions {
154 url?: string;
155 loginNames?: string | string[];
156 role: SharingRole;
157 emailData?: ISharingEmailData;
158 group?: RoleType;
159 propagateAcl?: boolean;
160 includeAnonymousLinkInEmail?: boolean;
161 useSimplifiedRoles?: boolean;
162}
163/**
164 * Represents email data.
165 */
166export interface ISharingEmailData {
167 /**
168 * The e-mail subject.
169 */
170 subject?: string;
171 /**
172 * The e-mail body.
173 */
174 body: string;
175}
176export interface IShareLinkSettings {
177 /**
178 * The optional unique identifier of an existing sharing link to be retrieved and updated if necessary.
179 */
180 shareId?: string;
181 /**
182 * The kind of the sharing link to be created.
183 */
184 linkKind: SharingLinkKind;
185 /**
186 * A date/time string for which the format conforms to the ISO 8601:2004(E) complete representation for calendar date and time of day and
187 * which represents the time and date of expiry for the anonymous link. Both the minutes and hour value must be specified for the
188 * difference between the local and UTC time. Midnight is represented as 00:00:00.
189 */
190 expiration?: string;
191 /**
192 * The role to be used for the sharing link. This is required for Flexible links, and ignored for legacy link kinds.
193 */
194 role?: SharingRole;
195 /**
196 * Indicates if the sharing link, should support anonymous access. This is required for Flexible links, and ignored for legacy link kinds.
197 */
198 allowAnonymousAccess?: boolean;
199}
200export interface IShareLinkRequest {
201 /**
202 * A string of JSON representing users in people picker format. Only needed if an e-mail notification should be sent.
203 */
204 peoplePickerInput?: string;
205 /**
206 * Whether to create the link or not if it doesn't exist yet.
207 */
208 createLink: boolean;
209 /**
210 * The e-mail data. Only needed if an e-mail notification should be sent.
211 */
212 emailData?: ISharingEmailData;
213 /**
214 * The settings for the sharing link to be created/updated
215 */
216 settings: IShareLinkSettings;
217}
218/**
219 * Represents a response for sharing a link
220 */
221export interface IShareLinkResponse {
222 /**
223 * A SharingLinkInfo that represents the sharing link. Will be populated if sharing operation is returning a sharing link.
224 */
225 sharingLinkInfo: ISharingLinkInfo;
226}
227export interface ISharingLinkInfo {
228 AllowsAnonymousAccess: boolean;
229 Created: string;
230 CreatedBy: IPrincipalInfo;
231 Expiration: string;
232 IsActive: boolean;
233 IsEditLink: boolean;
234 IsFormsLink: boolean;
235 IsUnhealthy: boolean;
236 LastModified: string;
237 LastModifiedBy: IPrincipalInfo;
238 LinkKind: SharingLinkKind;
239 ShareId: string;
240 Url: string;
241}
242export interface ISharingResult {
243 /**
244 * The relative URL of a page which can be navigated to, to show permissions.
245 */
246 PermissionsPageRelativeUrl?: string;
247 /**
248 * A collection of users which have new pending access requests as a result of sharing.
249 */
250 UsersWithAccessRequests?: any[];
251 /**
252 * An enumeration which summarizes the result of the sharing operation.
253 */
254 StatusCode?: SharingOperationStatusCode;
255 /**
256 * An error message about the failure if sharing was unsuccessful.
257 */
258 ErrorMessage?: string;
259 /**
260 * A list of UserSharingResults from attempting to share a securable with unique permissions.
261 */
262 UniquelyPermissionedUsers?: IUserSharingResult[];
263 /**
264 * Groups which were granted permissions.
265 */
266 GroupsSharedWith?: any[];
267 /**
268 * The SharePoint group users were added to, if any were added to a group.
269 */
270 GroupUsersAddedTo?: any;
271 /**
272 * A list of users being added to a SharePoint permissions goup
273 */
274 UsersAddedToGroup?: IUserSharingResult[];
275 /**
276 * A list of SPInvitationCreationResult for external users being invited to have access.
277 */
278 InvitedUsers?: IInvitationCreationResult[];
279 /**
280 * The name of the securable being shared.
281 */
282 Name?: string;
283 /**
284 * The url of the securable being shared.
285 */
286 Url?: string;
287 /**
288 * IconUrl
289 */
290 IconUrl?: string;
291}
292export interface IInvitationCreationResult {
293 Succeeded?: boolean;
294 Email?: string;
295 InvitationLink?: string;
296}
297export interface IUserSharingResult {
298 IsUserKnown?: boolean;
299 Status?: boolean;
300 Message?: string;
301 User?: string;
302 DisplayName?: string;
303 Email?: string;
304 CurrentRole?: SharingRole;
305 AllowedRoles?: SharingRole[];
306 InvitationLink?: string;
307}
308export interface ISharingRecipient {
309 email?: string;
310 alias?: string;
311}
312export interface ISharingEntityPermission {
313 /**
314 * The Input Entity provided to the Call.
315 */
316 inputEntity: string;
317 /**
318 * The Resolved Entity after resolving using PeoplePicker API.
319 */
320 resolvedEntity: string;
321 /**
322 * Does the Entity have Access to the Securable Object
323 */
324 hasAccess: boolean;
325 /**
326 * Role of the Entity on ListItem
327 */
328 role: SharingRole;
329}
330export interface ISharingInformationRequest {
331 /**
332 * Max Principal's to return.
333 */
334 maxPrincipalsToReturn: number;
335 /**
336 * Supported Features (For future use by Office Client).
337 */
338 clientSupportedFeatures: string;
339 /**
340 * Get links inherited from parent objects
341 */
342 populateInheritedLinks: boolean;
343}
344export interface IObjectSharingSettings {
345 /**
346 * The URL pointing to the containing SPWeb object
347 */
348 WebUrl: string;
349 /**
350 * The unique ID of the parent list (if applicable)
351 */
352 ListId?: string;
353 /**
354 * The list item ID (if applicable)
355 */
356 ItemId?: string;
357 /**
358 * The object title
359 */
360 ItemName: string;
361 /**
362 * The server relative object URL
363 */
364 ItemUrl: string;
365 /**
366 * Contains information about the sharing state of a shareable object
367 */
368 ObjectSharingInformation: any;
369 /**
370 * Boolean indicating whether the sharing context operates under the access request mode
371 */
372 AccessRequestMode: boolean;
373 /**
374 * Boolean indicating whether the sharing context operates under the permissions only mode
375 * (i.e. adding to a group or hiding the groups dropdown in the SharePoint UI)
376 */
377 PermissionsOnlyMode: boolean;
378 /**
379 * URL of the site from which the shared object inherits permissions
380 */
381 InheritingWebLink: string;
382 /**
383 * Boolean flag denoting if guest users are enabled for the site collection
384 */
385 ShareByEmailEnabled: boolean;
386 /**
387 * Boolean indicating whether the current user is a guest user
388 */
389 IsGuestUser: boolean;
390 /**
391 * Boolean indicating whether the site has the standard "Editor" role
392 */
393 HasEditRole: boolean;
394 /**
395 * Boolean indicating whether the site has the standard "Reader" role
396 */
397 HasReadRole: boolean;
398 /**
399 * Boolean indicating whether the object to share is a picture library
400 */
401 IsPictureLibrary: boolean;
402 /**
403 * Boolean indicating whether the folder object can be shared
404 */
405 CanShareFolder: boolean;
406 /**
407 * Boolean indicating whether email invitations can be sent
408 */
409 CanSendEmail: boolean;
410 /**
411 * Default share link type
412 */
413 DefaultShareLinkType: SharingLinkKind;
414 /**
415 * Boolean indicating whether the object to share supports ACL propagation
416 */
417 SupportsAclPropagation: boolean;
418 /**
419 * Boolean indicating whether the current user can only share within the tenancy
420 */
421 CanCurrentUserShareInternally: boolean;
422 /**
423 * Boolean indicating whether the current user can share outside the tenancy, by inviting external users
424 */
425 CanCurrentUserShareExternally: boolean;
426 /**
427 * Boolean indicating whether the current user can retrieve an anonymous View link, if one has already been created
428 * If one has not been created, the user cannot create one
429 */
430 CanCurrentUserRetrieveReadonlyLink: boolean;
431 /**
432 * Boolean indicating whether the current user can create or disable an anonymous Edit link
433 */
434 CanCurrentUserManageReadonlyLink: boolean;
435 /**
436 * Boolean indicating whether the current user can retrieve an anonymous Edit link, if one has already been created
437 * If one has not been created, the user cannot create one
438 */
439 CanCurrentUserRetrieveReadWriteLink: boolean;
440 /**
441 * Boolean indicating whether the current user can create or disable an anonymous Edit link
442 */
443 CanCurrentUserManageReadWriteLink: boolean;
444 /**
445 * Boolean indicating whether the current user can retrieve an organization View link, if one has already been created
446 * If one has not been created, the user cannot create one
447 */
448 CanCurrentUserRetrieveOrganizationReadonlyLink: boolean;
449 /**
450 * Boolean indicating whether the current user can create or disable an organization Edit link
451 */
452 CanCurrentUserManageOrganizationReadonlyLink: boolean;
453 /**
454 * Boolean indicating whether the current user can retrieve an organization Edit link, if one has already been created
455 * If one has not been created, the user cannot create one
456 */
457 CanCurrentUserRetrieveOrganizationReadWriteLink: boolean;
458 /**
459 * Boolean indicating whether the current user can create or disable an organization Edit link
460 */
461 CanCurrentUserManageOrganizationReadWriteLink: boolean;
462 /**
463 * Boolean indicating whether the current user can make use of Share-By-Link
464 */
465 CanSendLink: boolean;
466 /**
467 * Boolean indicating whether the client logic should warn the user
468 * that they are about to share with external email addresses.
469 */
470 ShowExternalSharingWarning: boolean;
471 /**
472 * A list of SharingPermissionInformation objects that can be used to share
473 */
474 SharingPermissions: any[];
475 /**
476 * A dictionary object that lists the display name and the id of
477 * the SharePoint simplified roles (edit, view)
478 */
479 SimplifiedRoles: {
480 [key: string]: string;
481 };
482 /**
483 * A dictionary object that lists the display name and the id of the SharePoint groups
484 */
485 GroupsList: {
486 [key: string]: string;
487 };
488 /**
489 * A dictionary object that lists the display name and the id of the SharePoint regular roles
490 */
491 Roles: {
492 [key: string]: string;
493 };
494 /**
495 * An object containing the SharePoint UI specific sharing settings.
496 */
497 SharePointSettings: any;
498 /**
499 * Boolean indicating whether the current user is a site collection administrator
500 */
501 IsUserSiteAdmin: boolean;
502 /**
503 * A value that indicates number of days an anonymous link can be valid before it expires
504 */
505 RequiredAnonymousLinkExpirationInDays: number;
506}
507export interface ISharingInformation {
508 /**
509 * External Sharing.
510 */
511 canAddExternalPrincipal?: boolean;
512 /**
513 * Internal Sharing.
514 */
515 canAddInternalPrincipal?: boolean;
516 /**
517 * Can Send Email.
518 */
519 canSendEmail?: boolean;
520 /**
521 * Can Use Simplified Roles present in Roles Enum.
522 */
523 canUseSimplifiedRoles?: boolean;
524 /**
525 * Has Unique Permissions.
526 */
527 hasUniquePermissions?: boolean;
528 /**
529 * Current Users Role on the Item.
530 */
531 currentRole?: SharingRole;
532 /**
533 * Does the User+Item require Approval from Admin for Sharing.
534 */
535 requiresAccessApproval?: boolean;
536 /**
537 * (Owners only)Whether there are pending access requests for the securable object.
538 */
539 hasPendingAccessRequests?: boolean;
540 /**
541 * (Owners only)The link to the access requests page for the securable object, or an empty string if the link is not available.
542 */
543 pendingAccessRequestsLink?: string;
544 /**
545 * sharedObjectType
546 */
547 sharedObjectType?: SPSharedObjectType;
548 /**
549 * Url for the Securable Object (Encoded).
550 */
551 directUrl?: string;
552 /**
553 * Parent Web Url for the Securable Object (Encoded).
554 */
555 webUrl?: string;
556 /**
557 * Default SharingLinkKind.
558 */
559 defaultLinkKind?: SharingLinkKind;
560 /**
561 * Tenant's SharingDomainRestrictionMode.
562 */
563 domainRestrictionMode?: SharingDomainRestrictionMode;
564 /**
565 * Tenant's RestrictedDomains.
566 */
567 RestrictedDomains?: string;
568 /**
569 * Tenant's Anonymous Link Expiration Restriction in Days.
570 */
571 anonymousLinkExpirationRestrictionDays?: number;
572 /**
573 * The PermissionCollection that are on the Securable Object (Princpals & Links)
574 */
575 permissionsInformation?: any;
576 /**
577 * PickerSettings used by the PeoplePicker Control.
578 */
579 pickerSettings?: any;
580}
581export declare enum RoleType {
582 None = 0,
583 Guest = 1,
584 Reader = 2,
585 Contributor = 3,
586 WebDesigner = 4,
587 Administrator = 5
588}
589//# sourceMappingURL=types.d.ts.map
\No newline at end of file