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.


Thursday, September 15, 2011

JQuery Intellisence for SharePoint 2010

Visual Studio 2010 is really have useful and helpful capabilities from tooling prospective and it allows JavaScript developers to more productive through JavaScript Intellisence and JavaScript debugging. This post discusses about getting the JavaScript Intellisense in SharePoint 2010 projects.


1. Create an empty SharePoint 2010 project as shown below
image
2. Add a new module to the project and call it as Module1
image
3. In solution explorer if you expand the Module file then you will see sample.txt file, just rename the file example.aspx
image
4. Change Elements.xml file to reflect the same
image
5. We are adding basic HTML mark up and JavaScript to references to example.aspx page as shown below
image
If you want to refer any local JavaScript files then you can add below the script reference tag.
6. If you add any reference to local JavaScript files then change the elements.xml file
image
In this post I am referring the Jquery-1.5-vsdoc.js in examples.aspx.js which contains the comments and gives you the good intellisense while writing the JavaScript code.
image
Now sooner you type the function names in the .js file then you will get the intellisense
image
image
image
7. Now run your application, it deploys all required files into server and launches the application in browser
image
8. Not just Jquery, You might probably want to interact with SharePoint Client object model. To do that add the SharePoint JavaScript files as reference to the project in .js file as shown below
image
these js files can be found in SharePoint Hive 14 directory
If you notice the reference syntax of JavaScript files, those are just look like comments but Visual Studio refers them to give you intellisense while writing the code.
image
Now run your application by putting a breakpoint in the code, it will hit the code while page is being loading
image
So Hope this post helps you in understanding of JavaScript Intellisense and JavaScript Debugging on SharePoint Client object model and improves SharePoint development productivity.


Friday, September 2, 2011

The search request was unable to connect to the Search Service in FAST with Sharepoint 2010

“The search request was unable to connect to the Search Service.”

Installed Fast search server binaries on a 64 bit machine and connected it to Sharepoint 2010 installation.
Everything went smooth, was able to create Query Service application and content service application, FAST Content application was able to crawl my data but still when i fired a search from FAST search center site ,I got an error message
“The search request was unable to connect to the Search Service.”
After hours of headbanging which included restarting the machine and recreating service application ,I looked at the obvious culprit
The QRproxy service on my fast search server was Dead.
To know about status go to your Fast Command shell and type
nctrl status
Every attempt to start the service failed
nctrl start qrproxy
Finally found out the error in system event Log it did not have Windows identity foundation installed.(Windows6.0-KB974405-x64.msu)
 
To fix the isuue simply download
http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=17331
Install and try starting the QRproxy service and it should be all set

Happy SharePoint....