.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal

Home >> Forum >> SharePoint >> Post New QuestionBookmark and Share Subscribe to Forum

Add new user to SharePoint Group

Posted By: Shruthi BM     Posted Date: June 02, 2011    Points:5   Category :SharePoint

Please help me to write a code when users are added to sharepoint group.

Currently i have written the code using C# but the issue is when user is added to the group in subsite, a email will trigger with the hyperlink which will redirects users to top site instead of subsite link.

Could you please help me to modify the code so that when users are added to sharepoint group in top site or subsite, accordingly users should receive a email with proper link where exactly the users are added.

code : C sharp

Shruthi BM

Author: Sunil Yadav       [Moderator]      
Posted Date: June 02, 2011     Points: 20   

Since you are writing a c# code, you can retrieve the user Email when adding user to a group or site and send the email to the user with the link of a site.

Let me know if you need any help.

Author: Shruthi BM             
Posted Date: June 03, 2011     Points: 20   


Everything is working fine. But the issue here is when users are added to sharepoint subiste, the site link in the email redirects to top site not to subsite.

I need to modify the code such that users should receive welcome email with correct link like if users are added to top site then link should redirect to top site. If users are added to subsite then link should redirect to subsite.

Currect code :


As in the above i have mentioned root web so only when users are added to subsite, link in the welcome email redirects to top site.

Please help me in code.

Shruthi BM

Author: Sunil Yadav       [Moderator]      
Posted Date: June 03, 2011     Points: 20   

Can u share you code?

Author: Dhiraj Ranka             
Posted Date: June 03, 2011     Points: 20   


If you are sending an email then you can control the link.

You can try "<SPWebObject>.Url" instead of "site.RootWeb.Url". This is will give you the absolute URL of the website.

Hope this helps

Hope this helps.

Thanks & Regards,
Dhiraj Ranka
http://www.twitter.com/dhirajranka | http://www.dhirajranka.com

Post Reply

You must Sign In To post reply
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend