Skip to content

Commit

Permalink
Merge pull request #3004 from microsoft-search/feature/414
Browse files Browse the repository at this point in the history
Support result web part as Teams app with SPFx Teams Context exposed
  • Loading branch information
wobba committed May 27, 2023
2 parents c9cde6a + 5921d10 commit 6ee4a07
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 3 deletions.
2 changes: 2 additions & 0 deletions search-parts/src/models/common/ITemplateContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ export interface ISearchResultsTemplateContext {
user: SPUser;
};

teamsContext:any;

/**
* The data source data
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"requiresCustomScript": false,
"supportsFullBleed": true,
"supportedHosts": [
"SharePointWebPart"
"SharePointWebPart", "TeamsTab", "SharePointFullPage","TeamsPersonalApp"
],
"supportsThemeVariants": true,
"preconfiguredEntries": [{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@ export default class SearchResultsWebPart extends BaseWebPart<ISearchResultsWebP
onDataRetrieved: this._onDataRetrieved,
onItemSelected: this._onItemSelected,
pageContext: this.context.pageContext,
teamsContext: this.context.sdks.microsoftTeams ? this.context.sdks.microsoftTeams.context : null,
renderType: this.properties.layoutRenderType,
dataContext: this._currentDataContext,
themeVariant: this._themeVariant,
Expand Down Expand Up @@ -761,8 +762,6 @@ export default class SearchResultsWebPart extends BaseWebPart<ISearchResultsWebP

// Reset paging information
this.currentPageNumber = 1;


}

// Reset layout properties
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ export interface ISearchResultsContainerProps {
*/
pageContext: PageContext;

/**
* The current page context
*/
teamsContext: any;

/**
* The selected data source instance
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,7 @@ export default class SearchResultsContainer extends React.Component<ISearchResul
Log.warn(LogSource, `Invalid host config provided. Refer to https://docs.microsoft.com/en-us/adaptive-cards/rendering-cards/host-config for more details`, this.props.serviceScope);
}


return {
// The data source data
data: {
Expand Down Expand Up @@ -527,6 +528,7 @@ export default class SearchResultsContainer extends React.Component<ISearchResul
cultureInfo: cultureInfo,
listItem: listItem
},
teamsContext: this.props.teamsContext,
// The Web Part instance ID for scoped CSS styles
instanceId: this.props.instanceId,
// Any other useful informations
Expand Down

0 comments on commit 6ee4a07

Please sign in to comment.