Thursday, September 22, 2011

SharePoint Workflow Alerts based on Days

 Creating SharePoint Workflow Alerts based on Days

Define: Automatically start when a new item is created
Workflow Steps:

Step 1: Set dates
Conditions: none
Run all actions in parallel
Actions: Add -60 days to Current Item:ExpDate (Output to Variable:60-day)
and Add -30 days to Current Item:ExpDate (Output to Variable:30-day)
and Add -10 days to Current Item:ExpDate (Output to Variable:10-day)

Step 2: ExpDate > Today + 60
Conditions: If Variable:60-day is greater than Today
Actions: Pause until Variable:60-day
then Add -60 days to Current Item:ExpDate (Output to Variable:60-day)

Step 3: 60 days notice
Conditions: If Variable:60-day is less than or equal to Today
and Variable:30-day is greater than Today
Actions: Send email
then Pause until Variable:30-day
then Add -30 days to Current Item:ExpDate (Output to Variable:30-day)
then Add -10 days to Current Item:ExpDate (Output to Variable:10-day)

Step 4: 30 days notice
Conditions: If Variable:30-day is less than or equal to Today
and Variable:10-day is greater than Today
Actions: Send email
then Pause until Variable:10-day
then Add -10 days to Current Item:ExpDate (Output to Variable:10-day)

Step 5: 10 days notice
Conditions: If Variable:10-day is less than or equal to Today
and Current Item:ExpDate is greater than Today
Actions: Send email
then Pause until Current Item:ExpDate

Step 6: Expiration notice
Conditions: If Current Item:ExpDate is less than or equal to Today
Actions: Send email




One thing that might make the whole process less confusing is to create a Variable:Orig ExpDate as the first step in both workflows. Then add to each of the Conditions (after the first Pause): "and Current Item:ExpDate = Variable:Orig ExpDate"

That will make sure you only have the workflow running which was triggered by the most recent change/create.
Conditions: If Current Item:ExpDate not equals Variable:Orig ExpDate
Actions: Stop workflow (Log "Expiration Date has been changed.")


Here are the results from my test:
1. Testing with long ExpDate ExpDate: 12/29/2011 Status: In Progress (No email rec'd yet)
2. ExpDate = Today + 60 ExpDate: 2/27/2011 Status: In Progress (Rec'd 60 day email)
3. ExpDate = Today + 61 ExpDate: 2/28/2011 Status: In Progress (No email rec'd yet; Changed to Today + 365: ExpDate: 12/29/2011, so I don't expect to get a notice tomorrow either)
4. ExpDate = Today + 30 ExpDate: 1/28/2011 Status: In Progress (Rec'd 30 day email)
5. ExpDate = Today + 31 ExpDate: 1/29/2011 Status: In Progress (Rec'd 60 day email)
6. ExpDate = Today + 10 ExpDate: 1/8/2011 Status: In Progress (Rec'd 10 day email)
7. ExpDate = Today + 11 ExpDate: 1/9/2011 Status: In Progress (Rec'd 30 day email)
8. ExpDate = Today ExpDate: 12/29/2010 Status: Completed (Rec'd Exp email)
9. ExpDate = Tomorrow ExpDate: 12/30/2010 Status: In Progress (Rec'd 10 day email)
10. ExpDate = Yesterday ExpDate: 12/28/2010 Status: Completed (Rec'd Exp email)


Tuesday, September 20, 2011

Get the current user details without writing single line of code on your InfoPath forms


 If you are already familiar with this, this post might still be useful. I have included the complete set of default properties get returned and their proper naming syntax at the bottom.
* This works at InfoPath as well as InfoPath Forms Services.
*Clayton Cobb has a great post if you to take the this a step further.
  1. With InfoPath opened go to Tools > Data Connections, and click 'add...' to add a new data connection to the form. This opens up the Data Connection Wizard.
  2. We want to receive data from the WS about the current user, so choose receive data' and click next.
  3. Our data source is a WS so choose 'Web Service' and next.
  4. Now you will have to point the wizard to the WS. Type an address similar to this: http://ServerName/_vti_bin/UserProfileService.asmx and click next.
  5. Here you get a list of all methods for that WS, choose GetUserProfileByName and click next.
  6. In this screen you can specify what parameters are sent to the method, we are relying on the method's ability to return the current user name if no value is passed to it, so we will leave this as is (no value is passed to the method) and click next.
  7. Click next and make sure 'Automatically retrieve data when form is opened' is checked.
  8. Finish the wizard.
The GetProfileByName method returns a PropertyData array. You can think of it as a repeating table of name and value pairs.
So Now that you have a data connection that can get the current users, you can use it values. In this example I will show the user's first name in a textbox.
  1. Add a textbox to the form.
  2. Go to the first textbox's properties (double click it).
  3. In the 'Default Value' part, click the 'fx' button next to the 'Value' field. this opens up the formula builder dialog.

    vc
  4. Click 'Insert field or group'.


  5. In the data sources drop down, choose the GetUserProfileByName data source.
  6. Expand all groups under the 'dataFields' group, and choose the 'value' field. Don't click OK yet!


  7. With data 'value' field selected, click the 'Filter Data...' button and 'Add...'.
  8. In the first drop down (value) select 'Select a field or group...' and choose the 'Name' field under the 'PropertyData' group.




  9. Leave the middle drop down as is ('is equal to') and in the last drop down choose 'type a text...'.


  10. This is the part where you specify which property to put in the textbox. As we said the method returns multiple properties about the user. For this textbox we want to put the user's first name in, so type 'FirstName' (this is case sensitive!). I have included the property list you can use here (just below), so if you want some other property, just type its name instead.
  11. That's it, all we have to do is to confirm everything so Click 'OK' for every open dialog box until you are back in the design mode.
  12. click 'Preview' and see the wonder!
  13. If you want more details repeat steps 1-11 and enter different property names in step 10.
Finally, as I Promised, here is the complete list of default profile properties get returned by the userprofileservice. I think they are pretty self explained:
UserProfile_GUID
AccountName
FirstName
LastName
PreferredName
WorkPhone
Office
Department
Title
Manager
AboutMe
PersonalSpace
PictureURL
UserName
QuickLinks
WebSite
PublicSiteRedirect
SPS-Dotted-line
SPS-Peers
SPS-Responsibility
SPS-Skills
SPS-PastProjects
SPS-Interests
SPS-School
SPS-SipAddress
SPS-Birthday
SPS-MySiteUpgrade
SPS-DontSuggestList
SPS-ProxyAddresses
SPS-HireDate
SPS-LastColleagueAdded
SPS-OWAUrl
SPS-ResourceAccountName
SPS-MasterAccountName
Assistant
WorkEmail
CellPhone
Fax
HomePhone

Monday, September 19, 2011

File Not Found and MOSS MA in UserProfile services in SharePoint 2010

SharePoint 2010 service applications – UserProfile Synch service is not synching the profiles from AD. When you check the Event Log and ULS logs its showing.

Goto ControlPanel\Administrative Tools\Services.. and 
Check the TWO Forefront Identity Manager Services are working or not.

Event Log:
The Forefront Identity Manager Service cannot connect to the SQL Database Server.
The SQL Server could not be contacted. The connection failure may be due to a network failure, firewall configuration error, or other connection issue. Additionally, the SQL Server connection information could be configured incorrectly.
Verify that the SQL Server is reachable from the Forefront Identity Manager Service computer. Ensure that SQL Server is running, that the network connection is active, and that the firewall is configured properly. Last, verify the connection information has been configured properly. This configuration is stored in the Windows Registry.

Log File:
0x1AE0 SharePoint Portal Server User Profiles et8j High UserProfileServiceUserStatisticsWebPart:LoadControl failed, Exception: System.IO.FileLoadException: The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) at Microsoft.Office.Server.UserProfiles.UserProfileConfigManager.InitializeIlmClient(String ILMMachineName, Int32 FIMWebClientTimeOut) at Microsoft.Office.Server.UserProfiles.UserProfileConfigManager..ctor(UserProfileApplicationProxy userProfileApplicationProxy, Guid partitionID) at Microsoft.SharePoint.Portal.WebControls.UserProfileServiceStatisticsWebPartBase.LoadControl(Object sender, EventArgs e) 639a4bee-e242-43ab-8815-c3339d4453d1

After further research found that the profile synch account must need a special permission in the 

Active directory , it is documented in our public KB.


Setting permissions by using the ACL editor
1. Open the Active Directory Users and Computers snap-in
2. On the View menu, click Advanced Features.
3. Right-click the domain object, such as "company.com", and then click Properties.
4. On the Security tab, if the desired user account is not listed, click Add; if the desired user account is listed, proceed to step 7.
5. In the Select Users, Computers, or Groups dialog box, select the desired user account, and then click Add.
6. Click OK to return to the Properties dialog box.
7. Click the desired user account.
8. Click to select the Replicating Directory Changes check box from the list.
9. Click Apply, and then click OK.
10. Close the snap-in.


INSERT A FLASH FILE INTO SHAREPOINT 2010 PAGES


INSERT A FLASH FILE INTO SHAREPOINT 2010 PAGES

<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"
WIDTH="550" HEIGHT="400" id="myMovieName">
< PARAM NAME=movie VALUE="myFlashMovie.swf">
< PARAM NAME=quality VALUE=high>
< PARAM NAME=bgcolor VALUE=#FFFFFF>
< EMBED src="/support/flash/ts/documents/myFlashMovie.swf" quality=high bgcolor=#FFFFFF WIDTH="550" HEIGHT="400"
NAME="myMovieName" ALIGN="" TYPE="application/x-shockwave-flash"
PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">
< /EMBED>
< /OBJECT>

Adding Flash to SharePoint 2010


How to embed SWF file to SharePoint 2010 pages?

Embedding SWF file in a SharePoint page involved two steps.
1. Enable browser File Handling access so that you can view flash content in SharePoint 2010
2. Embedding SWF file to SharePoint 2010 Page

Step 1: Go to Central Administration | Application Management | Manage Web Application

Adding Flash to SharePoint 2010
Step 2: Select your web application which you want to enable Flash
Select Web Application to enable Flash for SharePoint 2010
Step 3: Now click on General Settings and in the drop down list click General Settings
To enable flash in SharePoint 2010
Step 4: Scroll down and select the permissive radio button and click OK
Enable permissive to enable flash in SharePoint 2010
Step 5: Upload your flash contents to a folder in SharePoint including html, swf and all the supporting files. Get the URL of your index.html file and insert the page viewer web part in SharePoint and in Link section add your URL.
Flash Files in Folder in SharePoint 2010
INSERT A FLASH FILE INTO SHAREPOINT 2010 PAGES
INSERT A FLASH FILE INTO SHAREPOINT 2010 PAGES
Step 6: View your page and you should see your Embedding SWF file in a SharePoint 2010 Page
Embedded SWF file in a sharepoint Page



Hide View All Site Content and Recycle Bin in Quick Launch for SharePoint 2010 site


I assigned a task to hide “View All Site Content” and “Recycle Bin” link from left hand navigation of sharepoint 2010 site. I wanted to implement this without editing the master page in SharePoint Designer. I just open the page where i want to hide these links, i checked the source of that web page by right click and view source in internet explorer. I saw that both links are placed inside different tables that have different style classes. So i did the following steps to hide both links.
1. Site Settings > Edit Page
2. Add a Content Editor Web Part anywhere in the page.
3. Ope tool pane of Content Editor Web Part by clicking “Modify Shared Web Part” option from top right drop down of web part.
4. Click on “Source Editor” button inside tool-pane and in “Text Entry” window paste the following lines.


<style>
s4-specialNavLinkList {
display:none;
}
< /style>


5. Click Save
6. Expand Layout section inside toolpane.
7. Check the Hidden checkbox and click OK.

To Hide Quick Launch Bar.

In the HTML Source add the following and Click OK.
#s4-leftpanel{
display:none
}
.s4-ca{
margin-left:0px
}

Hide View All Site Content and Recycle Bin in Quick Launch

I assigned a task to hide “View All Site Content” and “Recycle Bin” link from left hand navigation of sharepoint site. I wanted to implement this without editing the master page in SharePoint Designer. I just open the page where i want to hide these links, i checked the source of that web page by right click and view source in internet explorer. I saw that both links are placed inside different tables that have different style classes. So i did the following steps to hide both links.
1. Site Settings > Edit Page
2. Add a Content Editor Web Part anywhere in the page.
3. Ope tool pane of Content Editor Web Part by clicking “Modify Shared Web Part” option from top right drop down of web part.
4. Click on “Source Editor” button inside tool-pane and in “Text Entry” window paste the following lines.

<style>
.ms-recyclebin {
display:none;
}
< /style>
< style>
.ms-quicklaunchheader{
display:none;
}
< /style>


5. Click Save
6. Expand Layout section inside toolpane.
7. Check the Hidden checkbox and click OK.