Tobias has published two very good articles about Developer Dashboard and SPMonitoredScope that can help you to track performance of your applicaltions
Developer Dashboard In 2010
22 Wednesday Dec 2010
Posted Sharepoint
in22 Wednesday Dec 2010
Posted Sharepoint
inTobias has published two very good articles about Developer Dashboard and SPMonitoredScope that can help you to track performance of your applicaltions
21 Tuesday Dec 2010
Posted Sharepoint, Tools
inTags
21 Tuesday Dec 2010
Posted Sharepoint
in
We used "Userprofileservice" in infopath form to populate user’s details. It works perfectly on client form but once convert to UDC and open in the web form. It gets error:
A runtime exception was detected. Details follow.
Message: The remote server returned an error: (503) Server Unavailable.
Techinal Details:
System.Net.WebException: The remote server returned an error: (503) Server Unavailable.
at System.Net.HttpWebRequest.GetResponse()
I know this is proxy error but still spent hours trying to solve the problem. Here are the list you need to check:
A. Disable the authentication loopback check
Re-enable the behavior that exists in Windows Server 2003 by setting the DisableLoopbackCheck registry entry in the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa registry subkey to 1. To set the DisableLoopbackCheck registry entry to 1, follow these steps on the client computer:
B. Enable the Web Service Proxy for InfoPath Service in Central Admin
C. Make sure the “UseFormsServiceProxy” attribute is set to True
D. Check the Proxy Setting in web.config, and I added the url in the bypasslist that look like our SPNs aren’t set up correctly.
<system.net>
<defaultProxy>
<proxy usesystemdefault="false" proxyaddress="http://xx.xx.xx.xx:8080/" bypassonlocal="true" />
<bypasslist>
<add address="moss.company.local" />
</bypasslist>
</defaultProxy>
</system.net>
Incidentally, the <bypasslist> element allows you to use Regular Expression like “xxx.xxx*” to specify addresses, so you can exclude whole ranges at will – quite neat.
NB: Remember to IISREST or recycle to clear the server cache
10 Friday Dec 2010
Posted Sharepoint
inI have upload all the user images to the User Photos folder in My Site, the image showing on the User profile page but when I do the people search, it doesn’t return image. After a few hours looking, I found there is a check box in the Picture property was unticked. Once I checked the box and run the full crawler on User Profile, all good now.
09 Thursday Dec 2010
Posted PowerShell, Sharepoint
inToday I was working on some cool features to update the User Profile store in SharePoint 2010 by Power Shell but I keep get this error was :
‘No User Profile Application available to service the request. Contact your farm administrator.’
function GetSpContext($url) { [Microsoft.SharePoint.SPSite]$site = GetSPSite -url $url return [Microsoft.Office.Server.ServerContext]::GetContext($site); } function GetProfileManager($url) { [Microsoft.Office.Server.ServerContext]$ctx = GetSpContext -url $url [Microsoft.Office.Server.UserProfiles.UserProfileManager]$upm = New-Object "Microsoft.Office.Server.UserProfiles.UserProfileManager" -ArgumentList $ctx return $upm; }
$upm = GetProfileManager -url http://chidev51
After Search around, I found the problem was Permission.
There are 2 place you need give your permission to “Full Control” . They are “Administrators” and “Permissions” :
08 Wednesday Dec 2010
Posted PowerShell
inTags
We have a system which contains thousands of InfoPath forms, the template files are in the SharePoint site. And some forms cannot be opened after some users editing because of the wrong InfoPath Cache. So I wrote the little scrip to loop all the forms and get HREF string to check if the url is valid.
Param($Path = "D:\Temp",[switch]$verbose) Write-Host $fc = new-object -com scripting.filesystemobject $folder = $fc.getfolder($path) $strFinder = "http.*xsn" $logfile = "D:\Temp\NPILog.txt" function ProcessFiles([string]$folderpath) { Write-host " + Processing all Forms from: $folderpath" $Forms = dir $folderpath "*.xml" Write-host " + $($Forms.count) Forms found" Write-host " + Processing all $($Forms.count) Forms located at: $folderpath" -fore White foreach($Form in $Forms) { Write-Host " + + Processing Form: $($Form.Name)" -fore White Find-String $strFinder $Form.FullName } } function Find-String($find, $path) { $url_values = New-Object System.Collections.ArrayList $i = 0 echo "Finding string `"$find`" in file contents and file names of path: $path" ls $path | select-string $find -list |% { echo "Processing contents of $($_.Path)"; (get-content $_.Path) |% { [regex]::matches($_, $find) |%{$url_values.Add($_.value); $i++}} } echo $url_values[0] if(Check-URL $url_values[0]) { Write-Host "$($path) href is fine" } else { Write-Host "$($path) href is wrong" -foregroundcolor red -backgroundcolor yellow Add-Content $logfile "$($path) href is wrong, checked at $(Get-Date)" } } function Check-URL($url) { $urlIsValid = $false try { $request = [System.Net.WebRequest]::Create($url) $request.Credentials = [System.Net.CredentialCache]::DefaultCredentials; $request.Method = 'HEAD' $response = $request.GetResponse() $httpStatus = $response.StatusCode $urlIsValid = ($httpStatus -eq 'OK') $tryError = $null $response.Close() } catch [System.Exception] { $httpStatus = $null $tryError = $_.Exception $urlIsValid = $false; } return $urlIsValid } Write-Host "$($folder.ShortName) " Write-Host " + Total Folders: $($folder.SubFolders.Count)" foreach ($i in $folder.SubFolders) { Write-Host " + Folder Name: $($i.ShortName)" ProcessFiles($i.Path) }
01 Wednesday Dec 2010
Posted Sharepoint
inTags
SharePoint timer job is running in different process named OWSTIMER.EXE.
SharePoint web application or site will run with the help of process W3WP.EXE.
So, the application configuration file is associated with the W3WP.EXE, so there is no way to access the web.config file in the owstimer.exe process at all. The context is completely different and out of domain. So, we need to call or access the web.config file explicitly in timer job. How to?
Remember, always C# is completely object oriented and you can access everything through objects.
Usually the timer job installed as a feature. And all the logic of the timer job will go inside the Execute() method. So, write below statements in that method and access the complete web.config file. Below is the example of accessing appsettings.
SPWebApplication webApplication = this.Parent as SPWebApplication; Configuration config = WebConfigurationManager.OpenWebConfiguration("/", webApplication.Name); String appValue = config.AppSettings.Settings["appSettingKey"].Value;
WebConfigurationManager is the class which is in the namespace Systen.Web.Configuration. This way, you can access the config settings from a web.config of a SharePoint web site.