Skip to content
This repository was archived by the owner on Aug 28, 2024. It is now read-only.

Commit fa08126

Browse files
removing property interfaces with wrong property names
1 parent 0f7615d commit fa08126

3 files changed

Lines changed: 11 additions & 77 deletions

File tree

src/sharepoint/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,7 @@ export {
8888
} from "./sitegroups";
8989

9090
export {
91-
UserUpdateResult,
92-
UserProps
91+
UserUpdateResult
9392
} from "./siteusers";
9493

9594
export {

src/sharepoint/sitegroups.ts

Lines changed: 7 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,7 @@
11
import { Queryable, QueryableInstance, QueryableCollection } from "./queryable";
2-
import { SiteUser, SiteUsers } from "./siteusers";
2+
import { SiteUsers } from "./siteusers";
33
import { Util } from "../utils/util";
4-
5-
/**
6-
* Properties that provide a getter, but no setter.
7-
*
8-
*/
9-
export interface GroupReadOnlyProperties {
10-
canCurrentUserEditMembership?: boolean;
11-
canCurrentUserManageGroup?: boolean;
12-
canCurrentUserViewMembership?: boolean;
13-
id?: number;
14-
isHiddenInUI?: boolean;
15-
loginName?: string;
16-
ownerTitle?: string;
17-
principalType?: PrincipalType;
18-
users?: SiteUsers;
19-
}
20-
21-
/**
22-
* Properties that provide both a getter, and a setter.
23-
*
24-
*/
25-
export interface GroupWriteableProperties {
26-
allowMembersEditMembership?: boolean;
27-
allowRequestToJoinLeave?: boolean;
28-
autoAcceptRequestToJoinLeave?: boolean;
29-
description?: string;
30-
onlyAllowMembersViewMembership?: boolean;
31-
owner?: number | SiteUser | SiteGroup;
32-
requestToJoinLeaveEmailSetting?: string;
33-
title?: string;
34-
}
35-
36-
/**
37-
* Group Properties
38-
*
39-
*/
40-
export interface GroupProperties extends GroupReadOnlyProperties, GroupWriteableProperties {
41-
__metadata: { id?: string, url?: string, type?: string };
42-
}
4+
import { TypedHash } from "../collections/collections";
435

446
/**
457
* Principal Type enum
@@ -93,7 +55,7 @@ export class SiteGroups extends QueryableCollection {
9355
*
9456
* @param props The properties to be updated
9557
*/
96-
public add(properties: GroupWriteableProperties): Promise<GroupAddResult> {
58+
public add(properties: TypedHash<any>): Promise<GroupAddResult> {
9759
let postBody = JSON.stringify(Util.extend(
9860
{ "__metadata": { "type": "SP.Group" } }, properties));
9961

@@ -175,7 +137,7 @@ export class SiteGroup extends QueryableInstance {
175137
* @param properties A GroupWriteableProperties object of property names and values to update for the user
176138
*/
177139
/* tslint:disable no-string-literal */
178-
public update(properties: GroupWriteableProperties): Promise<GroupUpdateResult> {
140+
public update(properties: TypedHash<any>): Promise<GroupUpdateResult> {
179141

180142
let postBody = Util.extend({ "__metadata": { "type": "SP.Group" } }, properties);
181143

@@ -188,8 +150,8 @@ export class SiteGroup extends QueryableInstance {
188150

189151
let retGroup: SiteGroup = this;
190152

191-
if (properties.hasOwnProperty("title")) {
192-
retGroup = this.getParent(SiteGroup, this.parentUrl, `getByName('${properties.title}')`);
153+
if (properties.hasOwnProperty("Title")) {
154+
retGroup = this.getParent(SiteGroup, this.parentUrl, `getByName('${properties["Title"]}')`);
193155
}
194156

195157
return {
@@ -203,5 +165,5 @@ export class SiteGroup extends QueryableInstance {
203165

204166
export interface SiteGroupAddResult {
205167
group: SiteGroup;
206-
data: GroupProperties;
168+
data: any;
207169
}

src/sharepoint/siteusers.ts

Lines changed: 3 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,7 @@
11
import { Queryable, QueryableInstance, QueryableCollection } from "./queryable";
22
import { SiteGroups } from "./sitegroups";
33
import { Util } from "../utils/util";
4-
import { UserIdInfo, PrincipalType } from "./types";
5-
6-
/**
7-
* Properties that provide a getter, but no setter.
8-
*
9-
*/
10-
export interface UserReadOnlyProperties {
11-
id?: number;
12-
isHiddenInUI?: boolean;
13-
loginName?: string;
14-
principalType?: PrincipalType;
15-
userIdInfo?: UserIdInfo;
16-
}
17-
18-
/**
19-
* Properties that provide both a getter, and a setter.
20-
*
21-
*/
22-
export interface UserWriteableProperties {
23-
isSiteAdmin?: string;
24-
email?: string;
25-
title?: string;
26-
}
4+
import { TypedHash } from "../collections/collections";
275

286
/**
297
* Properties that provide both a getter, and a setter.
@@ -34,11 +12,6 @@ export interface UserUpdateResult {
3412
data: any;
3513
}
3614

37-
export interface UserProps extends UserReadOnlyProperties, UserWriteableProperties {
38-
__metadata: { id?: string, url?: string, type?: string };
39-
}
40-
41-
4215
/**
4316
* Describes a collection of all site collection users
4417
*
@@ -89,7 +62,7 @@ export class SiteUsers extends QueryableCollection {
8962
*
9063
* @param id The id of the user
9164
*/
92-
public removeById(id: number | Queryable): Promise<void> {
65+
public removeById(id: number | Queryable): Promise<any> {
9366
let o = new SiteUsers(this, `removeById(${id})`);
9467
return o.post();
9568
}
@@ -148,7 +121,7 @@ export class SiteUser extends QueryableInstance {
148121
*
149122
* @param properties A plain object of property names and values to update for the user
150123
*/
151-
public update(properties: UserWriteableProperties): Promise<UserUpdateResult> {
124+
public update(properties: TypedHash<any>): Promise<UserUpdateResult> {
152125

153126
let postBody = Util.extend({ "__metadata": { "type": "SP.User" } }, properties);
154127

0 commit comments

Comments
 (0)