TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Omar moussaid
NA
22
974
Retrieve TimeSheets of all users
Oct 31 2017 4:38 AM
I have created a simple console C# application that retrieves TimeSheets of the admin user used in the Sharepoint athentification, but what i want to do is to retrieve all users TimeSheets for a certain period (TimeSheetPeriods), any ideas about how you can do this? any sample code?
here is my code may be i forgot something :
cntx.Load(cntx.Projects);
cntx.ExecuteQuery();
cntx.Load(cntx.TimeSheetPeriods, c => c.Where(p => p.Start <= DateTime.Now && p.End <= DateTime.Now).
IncludeWithDefaultProperties(p => p.TimeSheet,
p => p.TimeSheet.Lines.Where(l => l.LineClass == TimeSheetLineClass.StandardLine).
IncludeWithDefaultProperties(l => l.Assignment,
l => l.Assignment.Task,
l => l.Work)));
cntx.ExecuteQuery();
var myPeriod = cntx.TimeSheetPeriods.LastOrDefault();
if
(myPeriod ==
null
)
throw
new
Exception(
"Please create the periods in your server settings"
);
foreach
(var line
in
myPeriod.TimeSheet.Lines)
{
Console.WriteLine(
"ProjectName : "
+line.ProjectName);
Console.WriteLine(
"TaskName : "
+ line.TaskName);
foreach
(var work
in
line.Work)
{
Console.WriteLine(
"PlannedWork----->"
+ work.PlannedWork);
Console.WriteLine(
"ActualWork----->"
+ work.ActualWork);
Console.WriteLine(
"StartDate----->"
+ work.Start);
Console.WriteLine(
"TaskComment----->"
+ work.Comment);
}
}
Reply
Answers (
1
)
Dashboard(Chart) From SharePoint List or Spreadsheet.
Forms authentication failed for the request