I need to get list of staff for logged user in DashBoard

Question:

I notice that on page MyStaff.aspx is some kind of this list, so my question is: is there prepared some function to get this mystaff list? I also need read some information from CCM web, so is there way to get CCMContext on Dashboard?

Answer:

You can use the suggestions below,

1. You should get dashboardContext as follows:
a) if current site is dashboard;
var dashboardContext = DashboardContext.Current;
b) if current site is not dashboard;
using (var dashboardContext = DashboardContext.GetContext(SPContext.Current.Web))
{ //code }



2. You can get employees without resolving a group as follows:
dashboardContext.Dashboard.CurrentUserContext.CurrentUser.Employees;



3. You can get all employees as follows:
dashboardContext.Dashboard.CurrentUserContext.CurrentUser.GetAllEmployees();



4. If you need to get information from CCM here is an example:
.RunInCCMContext(
() =>
{ var profilePropertyStorage = CCMResolver.Resolve(); result = profilePropertyStorage.GetAll().Select(i => new CCMProperty(i)).Cast(); });



5. A lot of extensions you’ll find in class DashboardExtension for work with LMS, CCM and REM from Dashboard.
 
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

Article is closed for comments.

Powered by Zendesk