Posts

Showing posts from 2010

Improve Deployment Times for Mobile Project in Visual Studio 2008.

While working on a project mobile device in Visual Studio 2008 targetting .Net Framework 3.5, you can run into a issue where the deployment to the emulator can take a minute or more. There are a couple of ways that will help you get around this issue. First Method Step 1: Open windows explorer and go to C:\Windows\Microsoft.NET\Framework\v3.5 Step 2: Take a backup of the file Microsoft.CompactFramework.Common.targets Step 3: Open the file Microsoft.CompactFramework.Common.targets (You can open this file in Visual Studio) Step 4: Find this line    and change this to      Step 5:Save the file Step 6: Close and Reopen Visual Studio. Second Method Step 1: Open your mobile project in Visual Studio 2008 Step 2: Right click on the project and select Properties. Step 3: In Propeties screen, go to the Debug tab and add " /p:SkipPlatformVerification=true" to the Command Line Arguments. I prefer the second method as i am not changing a system setting and it...

New NetCFSvcUtil.exe for Windows 7 Environment.

If you are going to writing WCF Services for mobile devices, you have to use the NetCFSvcUtil tool to generate  a Windows Communication Foundation (WCF) client proxy to help developers consume WCF services on device.If you have Windows 7 then use this link   http://download.microsoft.com/download/6/2/0/6205ED05-E435-44FC-AA82-B763CA5F8B1A/NetCFSvcUtil.exe to get the version of NetCFSVCUtil.exe.

"405 Error: Method not Found" When you deploy WCF Service on Windows 7.

Image
When you deploy WCF Service on Windows 7 machine to IIS 7.0 and try to browse to the service from a browser you might get the 405 Error: Method not Found. One of the reason this might happen is that the feature "WCF HTTP Activation" and "WCF Non-HTTP Activation" are not installed by default. to enable these feature go to Start --> Control Tools --> Program and Feature. Click on "Turn Windows Features on or Off". On the "Turn Windows on or Off" dialog box, go to the section "Microsoft .NET Framework 3.5.1" and check both the boxes below this feature and click on the "Ok" button to install this feature. Once this feature has been installed, you should be able to browse to the WCF Service deployed to IIS 7.0.

Powershell Script that will deploy/upgrade Farm Based Solution to all Site Collections

This Powershell script can be used to deploy/upgrade your farm solutions to all the site collections in the farm. # SharePoint DLL [void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") #Cmdlet Install Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue ###REGION FUNCTIONS ##################################################################### #Adds a farm solution to a site. ##################################################################### function AddSolution() { $myError = $null Add-SPSolution -LiteralPath $Solution -ErrorAction:SilentlyContinue -ErrorVariable myError -Confirm:$false if ($myError -ne $null) { write-host -ForegroundColor 'red' $myError $myError = $null } else { write-host -ForegroundColor 'green' "Sucessfuly added the solution to the site" } } ##################################################################### #Deploys...

Apply Custom StyleSheet to the SharePoint 2010 Publishing site.

When you are implementing a custom stylesheet for a publishing site in SharePoint 2010, make sure that the custom stylesheet is the first one that is declared, like the declaration below, and also specify the value of the "After" attribute as nightandday.css. If this is not done then you will see that the nightandday stylesheet will still override some of the classes.   A good way of debugging the styles that are applied in SharePoint is to navigate to the SharePoint page in IE 8.0 or higher and press F12 key. This will open the developer tools window and you can navigate to the HTML element and look at the styles are being applied or overridden.

Workflow does not start automatically when items are created by a Web Application in SharePoint 2010

We had a Users list in SharePoint 2010 to which a workflow was attached. This workflow fires off when a item is created in the Users list. The Users list was getting populated through a web application which would let the users enter the data and then save the data to the Users list using the ClientContent object.         During testing, we made the application pool for the custom web application run under the same user as that of the SharePoint 2010 web application. This caused a wierd behaviour in that the items were getting written the User list but the workflow was not firing. There were no errors in the application logs, SharePoint logs or anywere else.        Turns out that SharePoint 2010 has a security feature that will prevent the workflow from starting automatically when items are created in a list from a custom Web Application which has the same Application Pool credentials as the SharePoint Application Pool. ...

Powershell Script that will deploy/upgrade Sandbox Solution.

Script that will let you deploy/upgrade a sandbox solution to a SharePoint 2010 site. Make sure that you at least an SharePoint site administrator before you run the script. # SharePoint DLL [void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") #Cmdlet Install Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue ###REGION FUNCTIONS ##################################################################### #Adds a Sandbox solution to a site. ##################################################################### function AddSolution() { $myError = $null Add-SPUserSolution -LiteralPath $Solution -Site $SiteURL -ErrorAction:SilentlyContinue -ErrorVariable myError -Confirm:$false if ($myError -ne $null) { write-host -foregroundcolor 'red' $myError $myError = $null } else { Write-host -foregroundColor 'green' 'Sucessfuly added the solution to the site' } } ...

Tool to View Logs in SharePoint 2010.

How many of us working in SharePoint have the pure pleasure of trawling through SharePoint logs after opening them in Notepad. No greater fun than this to make your day. While searching for totally different thing, i came across the log view tool ULSViewer ULS Viewer  which makes the job of looking at SharePoint logs easy. It can monitor the logs realtime, meaning if you have a solution or a timer job deployed, you can use the ULS Viewer to see the any entries being written real time.

Updating Column Attributes in Custom Content Type - SharePoint 2010

While working on a project SharePoint 2010 recently, i started to create Custom Content Types and deploy them as a feature in a sand box solution. As with all things that change over time, i reealized that a couple of the fields that we thought were not required were in fact required fields. No big deal, i said, opened the Elements.Xml and went to the fields and set the value of the Required attribute to "True" and deployed the solution and said to myself that i am done.      Not so fast. When i went to the SharePoint site and looked at the content types, the two fields were still showing up as optional in the content types. After browsing through bing and google and not comming with anything, and then after trail and error found that the value of the "Required" attrubute should be set to "TRUE" and not "True". After i made this change, everything was working fine.

Create Announcements and other lists in a Publishing Site in SharePoint 2010.

Recently was working on a SharePoint project that involved creating Announcements list. When i went to create the Announcements, i could not find the Announcements list template. To have the template show up, i had to go to Site Action --> Site Settings and on the Site Settings page, under the section Site Actions, click on Manage Site Features and activate the "Team Collaboration Lists" features. This will now let you create Annoucements and other lists on your site.

Unable to use DateTimeControl in SandBox solution

If you are developing a web part in SharePoint 2010 and want to deploy the web part as Sandbox solution then you will not be able to use controls from SharePoint namespace like DateTimeControl. Also you will not able to do a Page.Redirect from a Sandbox web part. If you really need to do these things, then for now you will have to change your web part to a farm based solution rather than a Sandbox solution.

Dynamically populate the controls in a custom Web Part for SharePoint 2010

While working a custom web part in sharePoint 2010, came across a interesting issue where i had to load controls dynamically based on the value in a drop down control. If i load the controls in the index changed event for the drop down then i would be unable to access thier poperties later in the code. As all the controls aare stored in the Page.Request, in the CreateChildControls i used Page.Request[lstServcices.UniqueID]  to get the value of the drop down. After checking that the value in the Page.Request[lstServices.UniqueID] was not null, i wrote the code for creating the dynamic controls. Make sure that you use control..UniqueID, which is a combination of $ $ $ ,  and not Control.ID.