Skip to content

Commit

Permalink
Merge pull request #1464 from joaojmendes/master
Browse files Browse the repository at this point in the history
updates
  • Loading branch information
hugoabernier authored Aug 29, 2020
2 parents 876aaa4 + baa8c23 commit df87dd9
Show file tree
Hide file tree
Showing 9 changed files with 300 additions and 160 deletions.
3 changes: 3 additions & 0 deletions samples/react-my-sites/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ Each Site has a symbol indicate if it is SharePoint Site, Group, Group and OnDri
If the Group has a microsoft team associated and user has permissions to access the symbol of teams will be displayed.




![MySites](./assets/MySites.gif)

![MySites](./assets/Screenshot%202020-08-06%20at%2013.50.51.png)
Expand Down Expand Up @@ -56,6 +58,7 @@ react-my-sites|João Mendes
Version|Date|Comments
-------|----|--------
1.0.0|August 6, 2020|Initial release
1.0.1|August 29, 2020|Additional updates

## Disclaimer

Expand Down
2 changes: 1 addition & 1 deletion samples/react-my-sites/config/package-solution.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"solution": {
"name": "react-my-sites-client-side-solution",
"id": "ad28b382-886b-4b2a-9646-92de8a0b1d13",
"version": "1.0.0.0",
"version": "1.0.1.0",
"includeClientSideAssets": true,
"skipFeatureDeployment": true,
"isDomainIsolated": false,
Expand Down
2 changes: 1 addition & 1 deletion samples/react-my-sites/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-my-sites",
"version": "0.0.1",
"version": "1.0.1",
"private": true,
"main": "lib/index.js",
"engines": {
Expand Down
5 changes: 3 additions & 2 deletions samples/react-my-sites/src/Entities/EnumFilters.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export enum Filters {
"SharePoint",
"All",
"Group",
"OneDrive",
"All",
"SharePoint",
"Site"
}
63 changes: 59 additions & 4 deletions samples/react-my-sites/src/Hooks/useUserSites.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ export const useUserSites = () => {
const getUserSites = async (
searchString?: string,
itemsPerPage?: number,
filter?: Filters
filter?: Filters,
site?:string
): Promise<SearchResults> => {
let searchResults: SearchResults = null;
let _filter: string = "";
Expand All @@ -62,12 +63,17 @@ export const useUserSites = () => {
_filter = ` GroupId:a* OR GroupId:b* OR GroupId:c* OR GroupId:d* OR GroupId:e* OR GroupId:f* OR GroupId:g* OR GroupId:h* OR GroupId:i* OR GroupId:j* OR GroupId:k* OR GroupId:l* OR GroupId:m* OR GroupId:n* OR GroupId:o* OR GroupId:p* OR GroupId:q* OR GroupId:r* OR GroupId:s* OR GroupId:t* OR GroupId:u* OR GroupId:v* OR GroupId:w* OR GroupId:x* OR GroupId:y* OR GroupId:z* OR GroupId:1* OR GroupId:2* OR GroupId:3* OR GroupId:4* OR GroupId:5* OR GroupId:6* OR GroupId:7* OR GroupId:8* OR GroupId:9* OR GroupId:0*`;
break;
case Filters.OneDrive:
_filter = " SiteGroup:Onedrive";
_filter = " WebTemplate:SPSPERS"; // OneDrive
// _filter = " SiteGroup:Onedrive";
break;
case Filters.SharePoint:
_filter =
" SiteGroup:SharePoint AND NOT(GroupId:b* OR GroupId:c* OR GroupId:d* OR GroupId:e* OR GroupId:f* OR GroupId:g* OR GroupId:h* OR GroupId:i* OR GroupId:j* OR GroupId:k* OR GroupId:l* OR GroupId:m* OR GroupId:n* OR GroupId:o* OR GroupId:p* OR GroupId:q* OR GroupId:r* OR GroupId:s* OR GroupId:t* OR GroupId:u* OR GroupId:v* OR GroupId:w* OR GroupId:x* OR GroupId:y* OR GroupId:z* OR GroupId:1* OR GroupId:2* OR GroupId:3* OR GroupId:4* OR GroupId:5* OR GroupId:6* OR GroupId:7* OR GroupId:8* OR GroupId:9* OR GroupId:0*)";
break;
case Filters.Site:
_filter = `Path:${site}`;

break;
}

const q = SearchQueryBuilder(
Expand All @@ -79,6 +85,11 @@ export const useUserSites = () => {
Direction: SortDirection.Descending,
})
.selectProperties(
"ParentLink",
"SPSiteURL",
"SiteID",
"SPWebUrl",
"WebId",
"SiteLogo",
"SiteClosed",
"RelatedHubSites",
Expand All @@ -94,14 +105,58 @@ export const useUserSites = () => {
"ModifiedById",
"LastModifiedTime",
"OriginalPath",
"Path",
"Title",
"Created"
"Created",
"WebTemplate"
);
const results = await sp.search(q);
searchResults = results; // set the current results
console.log(searchResults);
return searchResults;
};

return { getUserSites, checkGroupHasTeam };
// Get User Sites
const getUserWebs = async (

): Promise<SearchResults> => {
let searchResults: SearchResults = null;
const q = SearchQueryBuilder(
`(contentclass:STS_Web)`
)
.rowLimit(100000)
.selectProperties(
"ParentLink",
"SPSiteURL",
"SiteID",
"SPWebUrl",
"WebId",
"SiteLogo",
"SiteClosed",
"RelatedHubSites",
"IsHubSite",
"GroupId",
"RelatedGroupId",
"SiteGroup",
"Author",
"CreatedBy",
"CreatedById",
"AccountName",
"ModifiedBy",
"ModifiedById",
"LastModifiedTime",
"OriginalPath",
"Path",
"Title",
"Created",
"WebTemplate"
);
const results = await sp.search(q);
searchResults = results; // set the current results
console.log("webs",searchResults);
return searchResults;
};


return { getUserSites, checkGroupHasTeam, getUserWebs };
};
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { IContextualMenuProps } from "office-ui-fabric-react";

export interface IMySitesState {
sites: any[];
Expand All @@ -9,4 +10,7 @@ export interface IMySitesState {
totalPages:number;
searchValue:string;
currentFilter?:number;
currentFilterName?:string;
currentSelectedSite?:string;
filterMenuProps: IContextualMenuProps;
}
Loading

0 comments on commit df87dd9

Please sign in to comment.