Home

Conditional Home Page redirection based on the login user department

%3CLINGO-SUB%20id%3D%22lingo-sub-302693%22%20slang%3D%22en-US%22%3EConditional%20Home%20Page%20redirection%20based%20on%20the%20login%20user%20department%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-302693%22%20slang%3D%22en-US%22%3E%3CP%3EWe%20have%20a%20sharepoint%20classic%20team%20%2C%20and%20i%20created%20a%20new%20modern%20page%20%22OurCompany.aspx%22%20and%20i%20set%20it%20as%20the%20home%20page%20for%20our%20site.%20then%20i%20added%20modern%20pages%20for%20each%20department%3B%20HR.aspx%20%2C%20IT.aspx%2C%20Finance.aspx%20%2C%20and%20so%20on..%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Enow%20can%20i%20set%20a%20conditional%20home%20page%2C%20based%20on%20the%20login%20user%20department%20%3F%20so%20if%20a%20user%20is%20inside%20the%20IT%20department%20login%20to%20the%20sharepoint%20root%20site%20%22%3CA%20href%3D%22https%3A%2F%2Fourcompnay.sharepoint.com%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fourcompnay.sharepoint.com%3C%2FA%3E%22%20then%20instead%20of%20being%20redirected%20to%20the%20site%20home%20page%20%22OurCompany.aspx%22%20to%20be%20redirected%20to%20%22IT.aspx%22%3F%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-302693%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ESharePoint%20Online%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-302895%22%20slang%3D%22en-US%22%3ERe%3A%20Conditional%20Home%20Page%20redirection%20based%20on%20the%20login%20user%20department%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-302895%22%20slang%3D%22en-US%22%3EI%20meant%20a%20SPFx%20Extension%20that%20makes%20the%20redirection%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-302891%22%20slang%3D%22en-US%22%3ERe%3A%20Conditional%20Home%20Page%20redirection%20based%20on%20the%20login%20user%20department%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-302891%22%20slang%3D%22en-US%22%3E%3CBLOCKQUOTE%3E%3CHR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F60%22%20target%3D%22_blank%22%3E%40Juan%20Carlos%20Gonz%C3%A1lez%20Mart%C3%ADn%3C%2FA%3E%26nbsp%3Bwrote%3A%3CBR%20%2F%3EQuizhed%20is%20correct%2C%20you%20need%20some%20custom%20code%20to%20achieve%20this%20functionality...basically%3A%3CBR%20%2F%3E(1)%20In%20a%20classic%20page%2C%20you%20can%20add%20the%20redirection%20code%20in%20a%20Content%20Editor%20%2F%20Script%20Editor%20WebPart%3CBR%20%2F%3E(2)%20For%20modern%20pages%2C%20you%20need%20either%20a%20SPFx%20WebPart%20that%20allows%20to%20inyect%20the%20redirection%20code%20or%20create%20a%20SPFx%20Extension%3CHR%20%2F%3E%3C%2FBLOCKQUOTE%3E%3CP%3Eso%20you%20mean%20i%20will%20need%20to%20develop%20an%20SPFX%20web%20part%20%2C%20and%20then%20add%20the%20web%20part%20to%20our%20modern%20home%20page%3F%20and%20inside%20the%20SPFX%20i%20will%20need%20to%20retrieve%20the%20login%20user%20department%2C%20and%20do%20the%20redirection%20accordingly%20%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-302803%22%20slang%3D%22en-US%22%3ERe%3A%20Conditional%20Home%20Page%20redirection%20based%20on%20the%20login%20user%20department%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-302803%22%20slang%3D%22en-US%22%3E%3CP%3ENot%20quite%20what%20you%20want%2C%20but%20this%20approach%20by%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1173%22%20target%3D%22_blank%22%3E%40Joanne%20Klein%3C%2FA%3E%20may%20be%20helpful%20%3CA%20href%3D%22https%3A%2F%2Fjoannecklein.com%2F2018%2F07%2F11%2Ftagging-modern-pages-in-sharepoint-online%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fjoannecklein.com%2F2018%2F07%2F11%2Ftagging-modern-pages-in-sharepoint-online%2F%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Eand%20Audience%20Targeting%20is%20coming%20soon%2C%20see%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2FMicrosoft-SharePoint-Blog%2FRoadmap-Pitstop-November-2018%2Fba-p%2F293526%22%20target%3D%22_blank%22%3Ehttps%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2FMicrosoft-SharePoint-Blog%2FRoadmap-Pitstop-November-2018%2Fba-p%2F293526%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-302797%22%20slang%3D%22en-US%22%3ERe%3A%20Conditional%20Home%20Page%20redirection%20based%20on%20the%20login%20user%20department%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-302797%22%20slang%3D%22en-US%22%3EI%20wasn't%20correct%20as%20I%20said%20that%20I%20don't%20think%20that%20it%20can%20be%20achieved.%3CBR%20%2F%3ESorry%20John%20and%20thank%20you%20Juan.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-302786%22%20slang%3D%22en-US%22%3ERe%3A%20Conditional%20Home%20Page%20redirection%20based%20on%20the%20login%20user%20department%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-302786%22%20slang%3D%22en-US%22%3EQuizhed%20is%20correct%2C%20you%20need%20some%20custom%20code%20to%20achieve%20this%20functionality...basically%3A%3CBR%20%2F%3E(1)%20In%20a%20classic%20page%2C%20you%20can%20add%20the%20redirection%20code%20in%20a%20Content%20Editor%20%2F%20Script%20Editor%20WebPart%3CBR%20%2F%3E(2)%20For%20modern%20pages%2C%20you%20need%20either%20a%20SPFx%20WebPart%20that%20allows%20to%20inyect%20the%20redirection%20code%20or%20create%20a%20SPFx%20Extension%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-302777%22%20slang%3D%22en-US%22%3ERe%3A%20Conditional%20Home%20Page%20redirection%20based%20on%20the%20login%20user%20department%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-302777%22%20slang%3D%22en-US%22%3EI%20don't%20think%20so%2C%20as%20the%20websites%20in%20SharePoint%20are%20not%20designed%20like%20this%2C%20as%20far%20as%20I%20know.%3CBR%20%2F%3EYou%20may%20however%2C%20just%20send%20the%20specific%20site%20link%20to%20a%20specific%20user%20instead%20of%20the%20homepage%20if%20it%20helps%20with%20the%20query.%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-302762%22%20slang%3D%22en-US%22%3ERe%3A%20Conditional%20Home%20Page%20redirection%20based%20on%20the%20login%20user%20department%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-302762%22%20slang%3D%22en-US%22%3E%3CBLOCKQUOTE%3E%3CHR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F255181%22%20target%3D%22_blank%22%3E%40quizhead%3C%2FA%3E%26nbsp%3Bwrote%3A%3CBR%20%2F%3E%3CP%3EYou%20can%20only%20set%20permissions%20for%20the%20sites.%3C%2FP%3E%3CP%3EFor%20example%2C%20The%20IT%20user%20can%20enter%20only%20the%20IT%20site%20but%20will%20get%20an%20Unauthorized%20Access%20message%20when%20trying%20to%20access%20another%20site.%3CBR%20%2F%3EThere%20no%20are%20redirections%20in%20Sharepoint.%3C%2FP%3E%3CHR%20%2F%3E%3C%2FBLOCKQUOTE%3E%3CP%3Eok%20thanks%20for%20the%20reply.%20but%20can%20we%20achieve%20this%20using%20coding%20or%20development%20approaches%20%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-302737%22%20slang%3D%22en-US%22%3ERe%3A%20Conditional%20Home%20Page%20redirection%20based%20on%20the%20login%20user%20department%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-302737%22%20slang%3D%22en-US%22%3E%3CP%3EYou%20can%20only%20set%20permissions%20for%20the%20sites.%3C%2FP%3E%3CP%3EFor%20example%2C%20The%20IT%20user%20can%20enter%20only%20the%20IT%20site%20but%20will%20get%20an%20Unauthorized%20Access%20message%20when%20trying%20to%20access%20another%20site.%3CBR%20%2F%3EThere%20no%20are%20redirections%20in%20Sharepoint.%3C%2FP%3E%3C%2FLINGO-BODY%3E
john john
Super Contributor

We have a sharepoint classic team , and i created a new modern page "OurCompany.aspx" and i set it as the home page for our site. then i added modern pages for each department; HR.aspx , IT.aspx, Finance.aspx , and so on..

 

now can i set a conditional home page, based on the login user department ? so if a user is inside the IT department login to the sharepoint root site "https://ourcompnay.sharepoint.com" then instead of being redirected to the site home page "OurCompany.aspx" to be redirected to "IT.aspx"??

8 Replies

You can only set permissions for the sites.

For example, The IT user can enter only the IT site but will get an Unauthorized Access message when trying to access another site.
There no are redirections in Sharepoint.


@quizhead wrote:

You can only set permissions for the sites.

For example, The IT user can enter only the IT site but will get an Unauthorized Access message when trying to access another site.
There no are redirections in Sharepoint.


ok thanks for the reply. but can we achieve this using coding or development approaches ?

I don't think so, as the websites in SharePoint are not designed like this, as far as I know.
You may however, just send the specific site link to a specific user instead of the homepage if it helps with the query.
Quizhed is correct, you need some custom code to achieve this functionality...basically:
(1) In a classic page, you can add the redirection code in a Content Editor / Script Editor WebPart
(2) For modern pages, you need either a SPFx WebPart that allows to inyect the redirection code or create a SPFx Extension
I wasn't correct as I said that I don't think that it can be achieved.
Sorry John and thank you Juan.

@Juan Carlos González Martín wrote:
Quizhed is correct, you need some custom code to achieve this functionality...basically:
(1) In a classic page, you can add the redirection code in a Content Editor / Script Editor WebPart
(2) For modern pages, you need either a SPFx WebPart that allows to inyect the redirection code or create a SPFx Extension

so you mean i will need to develop an SPFX web part , and then add the web part to our modern home page? and inside the SPFX i will need to retrieve the login user department, and do the redirection accordingly ?

I meant a SPFx Extension that makes the redirection
Related Conversations
Conditional Formatting Formulas
jfh117 in Excel on
11 Replies
Conditional policies in Azure AD vs. Intune
Robert Woods in Microsoft Intune on
14 Replies
conditional formatting based on formula description
duco gm mansvelder in Excel on
3 Replies
Device Compliance
Baljit Aujla in Microsoft Intune on
21 Replies
Condition Access Question
Quinn Wade in Microsoft Intune on
1 Replies