When uploading files, the date created and date last modified is not taken from the file system. Instead, it is generated by Sharepoint.
You can build your own API to upload a file to Sharepoint and update the fields programmatically.
SPFieldUserValue author = new SPFieldUserValue(web, spUser.ID, spUser.LoginName);
listItem[SPBuiltInFieldId.Created] = dtCreated;
listItem[SPBuiltInFieldId.Modified] = dtModified;
listItem[SPBuiltInFieldId.Author] = author;
listItem[SPBuiltInFieldId.Editor] = author;
listItem.Update();
Tuesday, December 18, 2012
Monday, November 19, 2012
Infopath 2010 - Select a Photo from Picture Library
1. Copy the picture library by going to Picture Library Settings – Save Site as template (and include content) – optional. You can use the existing if you wish.
2. Take note of the photo URL of any picture – you will need this later.
3. Create a new Custom list. Just add one field, Employees as Person or Group. Make this field compulsory. You will add in the rest of the fields from Infopath later.4. Edit the form in Infopath 2010.
2. Take note of the photo URL of any picture – you will need this later.
3. Create a new Custom list. Just add one field, Employees as Person or Group. Make this field compulsory. You will add in the rest of the fields from Infopath later.4. Edit the form in Infopath 2010.
Labels:
sharepoint
Sunday, November 18, 2012
Infopath 2010 Only create new list item within a given date range
Create a Sharepoint 2010 list and add some fields.
Open the list in Infopath 2010 for editing.
Add a new variable, e.g. Today.
Add a new Form Load rule and assign the variable to the current date and time. This will be used for checking the date later.
Open the list in Infopath 2010 for editing.
Add a new variable, e.g. Today.
Add a new Form Load rule and assign the variable to the current date and time. This will be used for checking the date later.
Labels:
sharepoint
Sharepoint 2010 - Get Work Week
Sharepoint 2010 - Get Work Week
Excellent post on getting the Work Week or Week of Year from http://joranmarkx.wordpress.com/2011/12/09/use-the-calculated-field-to-show-weeknumber-in-sharepoint-2010/
For my own notes only, no plagiarism intended.
Work Week calculation:
If the work week starts from the Monday of the week that contains the first Thursday of the year:
=INT(([datecolumn]-DATE(YEAR([datecolumn]-WEEKDAY([datecolumn]-1)+4),1,3)+WEEKDAY(DATE(YEAR([datecolumn]-WEEKDAY(datecolumn-1)+4),1,3))+5)/7)
If the work week starts from the Monday of the week that contains the first Monday of the year:
=INT(([datecolumn]-DATE(YEAR([datecolumn]-WEEKDAY([datecolumn]-1)+4),1,3)+WEEKDAY(DATE(YEAR([datecolumn]-WEEKDAY(datecolumn-1)+4),1,3))+1)/7)
-Calculate the distance between the beginning of the year (with regard of the start of week 1) to the datecolumn
-Add the day of the week of the 1st January of the datecolumn year added with 5 (Thursday)
-Divide by number of days in a week
-Floor by doing a cast to INT
If week 1 starts in the week of the 1st January (USA Standards):
=INT(([datecolumn]-DATE(YEAR([datecolumn]),1,1)+(TEXT(WEEKDAY(DATE(YEAR([datecolumn]),1,1)),"d")))/7)+1
-Calculate the distance between the beginning of the year to the datecolumn
-Add day of the week of the 1st January of the datecolumn year
-Add divide by number of days in a week
-Cast to integer (is Floor)
-Add one day
Excellent post on getting the Work Week or Week of Year from http://joranmarkx.wordpress.com/2011/12/09/use-the-calculated-field-to-show-weeknumber-in-sharepoint-2010/
For my own notes only, no plagiarism intended.
Work Week calculation:
If the work week starts from the Monday of the week that contains the first Thursday of the year:
=INT(([datecolumn]-DATE(YEAR([datecolumn]-WEEKDAY([datecolumn]-1)+4),1,3)+WEEKDAY(DATE(YEAR([datecolumn]-WEEKDAY(datecolumn-1)+4),1,3))+5)/7)
If the work week starts from the Monday of the week that contains the first Monday of the year:
=INT(([datecolumn]-DATE(YEAR([datecolumn]-WEEKDAY([datecolumn]-1)+4),1,3)+WEEKDAY(DATE(YEAR([datecolumn]-WEEKDAY(datecolumn-1)+4),1,3))+1)/7)
-Calculate the distance between the beginning of the year (with regard of the start of week 1) to the datecolumn
-Add the day of the week of the 1st January of the datecolumn year added with 5 (Thursday)
-Divide by number of days in a week
-Floor by doing a cast to INT
If week 1 starts in the week of the 1st January (USA Standards):
=INT(([datecolumn]-DATE(YEAR([datecolumn]),1,1)+(TEXT(WEEKDAY(DATE(YEAR([datecolumn]),1,1)),"d")))/7)+1
-Calculate the distance between the beginning of the year to the datecolumn
-Add day of the week of the 1st January of the datecolumn year
-Add divide by number of days in a week
-Cast to integer (is Floor)
-Add one day
Labels:
sharepoint
Monday, September 3, 2012
Sharepoint 2010 - How to filter a view based on Sharepoint Groups
Some of you might have noticed that when we create views in Sharepoint and try to apply a filter based on Sharepoint Groups using equals to [Me] method, the filter will not work properly.
e.g.
User A is a member of Sharepoint Group S1.
In a list, one of the People columns, for example a list of people who can view, might contain S1 but not User A.
When User A views the list which is filtered based on the People column, the results he is supposed to view do not show up.
Workaround:
Open the view (with the filter) in Sharepoint Designer 2010 and locate the filter conditions. It will usually look like this:
<Query><Where><Or><Membership Type="CurrentUserGroups"><FieldRef Name="WhoCanView"/></Membership><Eq><FieldRef Name="WhoCanView"/><Value Type="Integer"><UserID Type="Integer"/></Value></Eq></Or></Where></Query>
Append the following before the <eq> tag:
<Membership Type="CurrentUserGroups"><FieldRef Name="WhoCanView"/></Membership>
Like this:
<Query><Where><Or><Membership Type="CurrentUserGroups"><FieldRef Name="WhoCanView"/></Membership><Eq><FieldRef Name="WhoCanView"/><Value Type="Integer"><UserID Type="Integer"/></Value></Eq></Or></Where></Query>
e.g.
User A is a member of Sharepoint Group S1.
In a list, one of the People columns, for example a list of people who can view, might contain S1 but not User A.
When User A views the list which is filtered based on the People column, the results he is supposed to view do not show up.
Workaround:
Open the view (with the filter) in Sharepoint Designer 2010 and locate the filter conditions. It will usually look like this:
<Query><Where><Or><Membership Type="CurrentUserGroups"><FieldRef Name="WhoCanView"/></Membership><Eq><FieldRef Name="WhoCanView"/><Value Type="Integer"><UserID Type="Integer"/></Value></Eq></Or></Where></Query>
Append the following before the <eq> tag:
<Membership Type="CurrentUserGroups"><FieldRef Name="WhoCanView"/></Membership>
Like this:
<Query><Where><Or><Membership Type="CurrentUserGroups"><FieldRef Name="WhoCanView"/></Membership><Eq><FieldRef Name="WhoCanView"/><Value Type="Integer"><UserID Type="Integer"/></Value></Eq></Or></Where></Query>
Labels:
sharepoint
Subscribe to:
Posts (Atom)