Archive for December, 2010

Show hide form elements in Microsoft Dynamics CRM 4.0 based on user role

December 27, 2010

Because Microsoft Dynamics CRM 4.0 only allows a single form for each entity it is often necessary to show or hide certain form elements like buttons, iFrames and tabs based on the role of the currently logged in user.

Calling the CrmService of Microsoft Dynamics CRM 4.0 allow us to determine who the currently logged in user is and what roles they have been assigned.  I have attempted to keep this example straightforward the only code that has nothing to do with getting the current user and their role are the the two line turning off a tab in the event the user doesn’t have the role of “Manager”.

    crmForm.all.tab2Tab.style.visibility = “hidden”;

    crmForm.all.tab2Tab.style.position = “absolute”;

Everything else is specific to calling the CrmService getting the current user and finding their user roles in the XML DOM that the CrmService returns.

//Based on the role of the user logged in, hide the named tab on the entity form 

if 

(currentUserHasRole(‘Manager’)) {else 

crmForm.all.tab2Tab.style.visibility = 

crmForm.all.tab2Tab.style.position = 

{“hidden”;“absolute”;function 

UserHasRole(roleName) {}function 

xmlhttp.open( 

xmlhttp.setRequestHeader( 

xmlhttp.setRequestHeader( 

soapXml += GenerateAuthenticationHeader(); 

soapXml += soapBody; 

soapXml += 

xmlhttp.send(soapXml); 

xmlDoc = 

xmlDoc.async = 

xmlDoc.loadXML(xmlhttp.responseXML.xml); 

getUserId() {try {var xmlhttp = new ActiveXObject(“Msxml2.XMLHTTP”);“POST”, “../../mscrmservices/2007/crmservice.asmx”, false);“Content-Type”, “text/xml; charset=utf-8″);“SOAPAction”, “http://schemas.microsoft.com/crm/2007/WebServices/Execute”);var soapBody = “<soap:Body>” + “<Execute xmlns=’http://schemas.microsoft.com/crm/2007/WebServices’>” + “<Request xsi:type=’WhoAmIRequest’ />” + “</Execute></soap:Body>”;var soapXml = “<soap:Envelope “ + “xmlns:soap=’http://schemas.xmlsoap.org/soap/envelope/’ “ + “xmlns:xsi=’http://www.w3.org/2001/XMLSchema-instance’ “ + “xmlns:xsd=’http://www.w3.org/2001/XMLSchema’>”;“</soap:Envelope>”;new ActiveXObject(“Microsoft.XMLDOM”);false;var userid = xmlDoc.getElementsByTagName(“UserId”)[0].childNodes[0].nodeValue;return userid;catch (e) {return null;function 

command.SetParameter( 

getUserRoles(userId) {try {var command = new RemoteCommand(“UserManager”, “GetUserRoles”);“userIds”, “<guid>” + userId + “</guid>”);var oResult = command.Execute();if (oResult.Success) {return oResult.ReturnValue;catch (e) {return null;function 

result = getUserRoles(userId); 

oXml.resolveExternals = 

oXml.async = 

oXml.loadXML(result); 

roleNode = oXml.selectSingleNode( 

hasRole = 

userHasRole(userId, roleName) {var hasRole = false;if (result != null) {var oXml = new ActiveXObject(“Microsoft.XMLDOM”);false;false;“/roles/role[name='” + roleName + “‘]“);if (roleNode != null) {if (roleNode.selectSingleNode(“roleid[@checked=’true’]“) != null) {true;return hasRole;function 

userId = getUserId(); 

currentUserHasRole(roleName) {return userHasRole(userId, roleName);

PowerGUI

December 23, 2010

PowerGUI.org – a free community for PowerGUI, a graphical user interface and script editor for Microsoft Windows PowerShell!

Visiting PowerGUI.org and sharing our passion for Microsoft Windows PowerShell. Within this PowerShell community you will find many resources. Download the latest version of PowerGUI, view the documentation, discuss your issues and ideas in our forums, and browse our open source library or submit your own scripts and PowerPacks to share. First Visit? Check out our Videos, Tutorials, and Demos.

Microsoft SharedView

December 20, 2010

Microsoft SharedView is a fast, easy way to share documents and screen views with small groups of friends or coworkers; anytime, anywhere. Use SharedView to put your heads together and collaborate – create, convey, and communicate…across physical boundaries, through firewalls, and down to the smallest details.

Download

FREE DOWNLOAD – You can install the latest SharedView application sharing software for free!

Some important tips on using SharedView:

  1. To start a session using this program, you must sign in using a Windows Live ID (Passport ID). However, you can use any e-mail ID or even a friendly name to join a session. A friendly name is a name of your choice. This is the name that others in the session will use to identify you.
  2. If you want to start a session and do not have a Windows Live ID, you can continue installing this program. However, before signing in, you must get a new Windows Live™ ID.
  3. If you are already using this program, you will see an upgrade notification that redirects you to the installation site.

You must have a working Internet connection to use this program.

Microsoft Dynamics CRM 2011 Release Candidate (RC) Announcement

December 17, 2010

The Microsoft Dynamics CRM 2011 Release Candidate (RC) is now available for download in the Microsoft Download Center.  As with the Microsoft Dynamics CRM 2011 Beta, the Release Candidate is available for anyone to download, and will be available until the RTM release scheduled for Q1, 2011.   This release represents the combined efforts and feedback from customers and partners working on the Microsoft Dynamics CRM 2011 Beta so thank you for all of you involved in this process.

Upgrades:  On-premises Beta databases can be upgraded to this new RC release which can then be upgraded to the upcoming RTM release.  CRM Online Beta customers will continue to have access to their CRM Online Beta instance until the CRM Online RTW launch in January, at which time they can choose to opt-in to upgrade their Beta instance to a production subscription.

Release Candidate is the last external milestone before the CRM Online Release to Web (RTW) launch in January 2011, and the on-premises Release to Manufacturing (RTM) in Q1, 2011, so please continue testing and validating this new pre-release version as well as continue building your deployments and solutions to be ready for the RTW and RTM releases.

Microsoft Dynamics CRM 2011 Server Release Candidate

http://www.microsoft.com/downloads/details.aspx?FamilyID=c3f82c6f-c123-4e80-b9b2-ee422a16b91d

Available in English only 

Microsoft Dynamics CRM 2011 for Microsoft Office Outlook

http://www.microsoft.com/downloads/details.aspx?FamilyID=22dc423a-7194-491e-a169-6ace16bfdd36

Available in 25 languages

Microsoft Dynamics CRM 2011 Language Pack

http://www.microsoft.com/downloads/details.aspx?FamilyID=db44c564-2338-407e-980a-c9c83ad37729

Available in 41 languages

Microsoft Dynamics CRM 2011 E-mail Router

http://www.microsoft.com/downloads/details.aspx?FamilyID=a995f6ad-0099-42fd-9b22-cf7b3d40a2bf

Available in 25 languages

Microsoft Dynamics CRM 2011 Report Authoring Extension

http://www.microsoft.com/downloads/details.aspx?FamilyID=64a09b75-8376-4b9d-aea3-8a83a1837c4d

Available in 25 languages

Microsoft Dynamics CRM 2011 List Component for Microsoft SharePoint Server 2010

http://www.microsoft.com/downloads/details.aspx?FamilyID=23c0f351-8694-4d92-9ddf-34a949aec6a7

Available in 41 languages

How to open a closed Web Part in SharePoint

December 15, 2010

When you click on the edit dropdown on a Web Part you are presented with a few options including Close and Delete. It seems that most users are scared by what would happen if they delete the web part, so they close it.  It doesn’t show on the page so it must be gone!

But have you ever wondered what the difference is between closing a Web Part and deleting it? When you close a Web Part although it doesn’t show up, it is still on the page and does whatever it is supposed to do.  For example, if you had a Content Query Web Part and closed it – everytime the page was opened it wouldn’t display but it would still run its query.
It is a small hit, but I’ve seen on more than one occasion users who close Web Parts instead of deleting them and end up with 10+ closed Web Parts on the page.
 
The million dollar question is, how do you open Web Part once it has been closed?  You can try appending ?contents=1 and get to the Web Part Maintenance screen, but that doesn’t help. 
 
To open a closed Web Part:
  1. Place the page into edit mode
  2. Click Add a Web Part at the top of a Web Part Zone
  3. In the lower right hand corner of Add Web Parts window, click on Advanced Web Part Gallery and options.
  4. In the top section of the Advanced Web Part Gallery, there is a link called Closed Web Parts. Click on this to display all of your closed Web Parts.
  5. To add them back to the page simply drag them back onto the page in your favorite Web Part Zone.

I can’t really think of many good situations where it is a good idea to close Web Parts on the page. If you want to save them, it is better to export them and save them off. They can always be added back later if needed.  The best plan is that if you don’t want a Web Part to show on the page – delete it! If it is a pain to set up and you want to make sure you don’t have to go through a bunch of trouble next time then export it and save it off.

Composite C1 free open source content management system

December 13, 2010

Composite C1 is a free open source content management system based on the Microsoft .NET 4 platform.
Composite C1 allows companies and organizations, individuals or communities of users to easily publish, manage and organize a wide variety of content on a website. With Composite C1 you have the freedom to choose and switch between a free open source licence or a paid subscription model. Composite C1 is:

A professional fully featured CMS
Simple to extend and customize
Based on the latest Microsoft technology
Developed by and for professional web developers
Succesfully powering numerous corporate web sites
Based on a developer model and licence options that prevents vendor lock-in and secures your independence
Easy on the editor
The user interface is task oriented and enable newcomers to maintain the website content on a daily basis while making it possible for the experienced editor to control the corporate webexperience.

In Control -down to the last detail
Frontend and XSLT developers are able to control website look and feel in detail and are treated with the technical respect they deserve. .NET developers have access to the latest technologies, .NET 4, ASP.NET 4 Controls, ASP.NET MVC, pure LINQ data access, Workflow Foundation, a pluggable architecture and a documented API. If you need the complete source code for Composite C1, it’s licensed under MPL 1.1 and available at http://compositec1.codeplex.com/.

Simple business model: One edition – dual licenses
Composite C1 is distributed for free, and the Open Source licensed version is 100 % identical with the commercially licensed version, giving you the freedom to change your mind and avoid vendor lock-in. In addition to a commercial licence that gives companies benefits like product warranty, Composite also offers professional services like support, training, upgrade tools and commercially oriented modules.

BugTracker.NET

December 11, 2010

Tracker.NET is a free, open-source, web-based bug tracker or customer support issue tracker written using ASP.NET, C#, and Microsoft SQL Server (or its free cousin, SQL Server Express). It is in daily use by thousands of development and customer support teams around the world.

BugTracker.NET is easy to install and learn how to use. When you first install it, it is very simple and you can start using it right away. Later, you can change its configuration to handle your needs if they are more complex.

Read what others have written about BugTracker.NET.

Try a BugTracker.NET demo. The demo shows just one possible way BugTracker.NET can be configured, so even if the demo isn’t exactly what you are looking for, you should still download BugTracker.NET and see if you can configure it to meet your needs.

If BugTracker.NET doesn’t fit your needs, see some comparisons of other issue tracking systems .

Download

For detailed info about features, see the documentation. Here are some feature highlights:

Highly configurable. You can configure it to use as a simple bug tracking system for a small team, or configure it with a workflow, permissions for a larger organization. Works great as a helpdesk system, a customer support ticket system.

Email integration. Sending and receiving emails is integrated with the tracker, so that the email thread about a bug is tracked WITH the bug. You can setup an email address and BugTracker.NET will turn those incoming emails into items in the database.

Search. Fast, easy, powerful search, both full-text and based on selected criteria like status, project, etc.

Screen capture utility. Take a screenshot, annotate it, and post it as a bug with just a few clicks. A Firefox add-on [download] to do screen captures too. An Android app too.

Custom fields, custom workflow.

Customized lists, filtered and sorted the way you want, with the columns that you want, with the colors that you want.

Email notifications. Get an email whenever any bug has been added or changed. Fine tune your settings so you only get notified about the bugs you care about.

Link related bugs. You can even merge duplicates.

Management reports with pie, line, and bar charts. Create your own reports.

“Skinnable” using CSS and/or your own custom HTML. Brand it with your company name, your logo, custom links to your own pages.

Subversion, Git, and Mercurial integration.

LDAP/Active Directory integration. You can configure BugTracker.NET so that users are automatically registerd when they visit BugTracker.NET for the first time.

Time tracking.

Supports Unicode (Chinese characters, etc. . . )

SharePoint – Open documents in new window

December 9, 2010

Let’s take one scenario where your client does not have office installed and you also want to deal with document library.

Now we know that there is a settings in document library settings that if client do not have office installed at machine, then MOSS will automatically open document in the browser window. it automatically check for the availability of office at client side and if not found then opens it in same browser.

The settings for this is as follows :

(1) Go to your document library.
(2) Click on Settings-> document library settings
(3) Click on advanced settings
(4) Check for “Browser-enabled Documents” section and select Display as a Web page.
(5) Press OK.

Now you have set this option and if your client does not have office installed then MOSS will automatically open document in browser.

but but but…..notice that it opens in same browser…So if you want that document opens in new windows, not in the same browser then…..???

so Here is a trick to go for it :

But remember that this change will apply to all document libraries of all web applications. Because we are going to change the Global onet.xml. So be aware..

Here we go..

(1) Open C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\GLOBAL\XML

(2)Open ONET.XML

(3)Search for this line <Else><HTML><![CDATA[<A onfocus=”OnLink(this)” HREF=”]]></HTML>

(4)Change it to <Else><HTML><![CDATA[<A onfocus=”OnLink(this)” target=”_new” HREF=”]]></HTML>

(5)Find one more line : <Else><HTML><![CDATA[<A TABINDEX=-1 HREF=”]]></HTML>

(6)Change it to <Else><HTML><![CDATA[<A TABINDEX=-1 target=”_new” HREF=”]]></HTML>

(7)Rest the IIS and just check…..

now all documents will open in new window..

How to make MOSS 2007 search results open in new window

December 7, 2010

The tip about opening links in new windows instead of the same window was a great idea but I couldn’t use the same tips since it was for SPS 2003. I wanted to be able to open links in new windows since I noticed a lot of users often times were searching for say PDF’s and then they would accidentally close the browser instead of hitting the back button. Big annoyance for them.
So I was snooping around the Search Core Results Web Part’s XSL Editor to see if I could edit the XSL to open links in new windows instead. It’s actually pretty easy, here are the steps:

1. Go to http://portal/searchcenter/pages/results.aspx

2. Modify Shared Web Part for the Search Core Results WebPart

3. Click on the XSL Editor Button

4. I’d suggest copying the contents of the pop up into notepad/wordpad to do your editing.

5. Search for the following lines:

<span class=”srch-Icon”>
<a href=”{$url}” id=”{concat(‘CSR_IMG_’,$id)}” title=”{$url}”>

______________________________________________

<span class=”srch-Title”>
<a href=”{$url}” id=”{concat(‘CSR_’,$id)}” title=”{$url}”>

____________________________________________________

<xsl:choose>
<xsl:when test=”$IsThisListScope = ‘True’ and contentclass[. = ‘STS_ListItem_PictureLibrary’] and picturethumbnailurl[. != ”]“>
<div style=”padding-top: 2px; padding-bottom: 2px;”>
<a href=”{$url}” id=”{concat(‘CSR_P’,$id)}” title=”{title}”>

__________________________________________

<span class=”srch-URL”>
<a href=”{$url}” id=”{concat(‘CSR_U_’,$id)}” title=”{$url}” dir=”ltr”>

____________________________________________

6. At the ends of each of the <a href= > tags, you’ll want to add on target=”_blank”

For example to make the link attached to the document icon open in a new window, the full tag would be like this:

<span class=”srch-Icon”>
<a href=”{$url}” id=”{concat(‘CSR_IMG_’,$id)}” title=”{$url}” target=”_blank”>

Using the same XSL Editor you can also manipulate how your search results are displayed and even include custom content types if you wanted to!

Run the SQL Script to Create and Register a User with DNN

December 5, 2010

The following SQL Script was written by Mitchel Sellers and can be found in the article Creating a Standard DotNetNuke User Via SQL.
Go to Host > SQL

Copy the following script and paste it in the text box. Alternatively you can save the file that comes with this article and load it via the Browse button. The SQL script is the following:

/*
THE FOLLOWING STORED PROCEDURE CAN BE USED TO CREATE AND REGISTER A USER WITH DNN. IN ORDER TO WORK, THIS PROCEDURE NEEDS TO HAVE A DEFAULT USER ACCOUNT FROM WHICH TO COPY THE PASSWORD DETAILS.
*/

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE spr_dnm_RegisterUser

–@RootUser nvarchar ( 256 ),
@FirstName nvarchar (256),
@LastName nvarchar (256),
@DisplayName nvarchar (256),
@UserName nvarchar(256) ,
@Email nvarchar(256)

/*
@Password nvarchar(128), –From the existing user
@PasswordSalt nvarchar(128), –From the existing user
@PasswordFormat int, –From the existing user
@PortalId int, –From the existing data
*/

/*
@ApplicationName nvarchar(256) = ‘DotNetNuke’,
@PasswordQuestion nvarchar(256) = ”,
@PasswordAnswer nvarchar(128) = ”,
@IsApproved bit = 1,
@CurrentTimeUtc datetime = NULL,
@CreateDate datetime = NULL,
@UniqueEmail int = 0
*/

AS
BEGIN

DECLARE @RootUser nvarchar (15) = ‘dummy’

DECLARE @ApplicationName nvarchar(256) = ‘DotNetNuke’
DECLARE @PasswordQuestion nvarchar(256) = ”
DECLARE @PasswordAnswer nvarchar(128) = ”
DECLARE @IsApproved bit = 1
DECLARE @CurrentTimeUtc datetime = NULL
DECLARE @CreateDate datetime = NULL
DECLARE @UniqueEmail int = 0

/*
SET @ApplicationName = ‘DotNetNuke’
SET @PasswordQuestion = ”
SET @PasswordAnswer = ”
SET @IsApproved = 1
SET @CurrentTimeUtc = NULL
SET @CreateDate = NULL
SET @UniqueEmail = 0
*/

SET NOCOUNT ON;

DECLARE @UserId uniqueidentifier
DECLARE @DNNUserId int

DECLARE @Password nvarchar(128) –From the existing user
DECLARE @PasswordSalt nvarchar(128) –From the existing user
DECLARE @PasswordFormat nvarchar(256) –From the existing user
DECLARE @PortalId int — From the existing data

IF ( @CurrentTimeUtc IS NULL ) SET @CurrentTimeUtc = GETDATE()
IF ( @CreateDate IS NULL ) SET @CreateDate = GETDATE()

SELECT @Password = m.password, @PasswordSalt = m.passwordsalt, @PasswordFormat = m.passwordformat
FROM aspnet_users u INNER JOIN aspnet_membership m ON (u.userid = m.userid)
WHERE u.UserName = @RootUser

SELECT @PortalId = PortalID–,PortalName
FROM Portals

–Make the stored procedure call
EXEC dbo.aspnet_Membership_CreateUser @ApplicationName, @Username, @Password,
@PasswordSalt, @email, @passwordquestion, @PasswordAnswer,
@IsApproved, @CurrentTimeUtc, @CreateDate, @UniqueEmail,
@PasswordFormat, @UserId

–Insert the record into the DotNetNuke users table
INSERT INTO users ( Username, FirstName, LastName, IsSuperUser, Email, DisplayName, UpdatePassword )
VALUES ( @Username, @FirstName, @LastName, 0, @Email, @DisplayName, 1 )

–Get the new userid, from the DNN users table
SELECT @dnnuserid = userid
FROM Users WHERE username = @Username

–Now, insert the record into the user portals table
INSERT INTO UserPortals (userId, PortalId, CreatedDate)
VALUES(@dnnuserid, @PortalId, GETDATE())

–Now Give the user permissions to the RECISTERED Users group
INSERT INTO UserRoles (userId, roleId)
SELECT @dnnuserid, roleId
FROM Roles
WHERE RoleName = ‘Registered Users’

END
GO

Change the value of @RootUser variable to the default user name created for example User Name: Dummy Password: DefPassword

Check the Run as Script checkbox and press Execute