Hi
While querying user profile changes we can get changes upto last 14 days.
Now,I want to know about recenet activities web part which shows user profile edits by the user. Up to which point in the past , it shows the user profile changes as recent activities ?
I need to know the duration (in days) in past for which the changes in user profile are reflected as recent activities on page : http://<server>/my/Person.aspx?accountname=domain\AccountID
Reply 1
Helo Heamntrhtk,
Check on this site you can configure it: http://sharepointsolutions.blogspot.com/2010/11/sharepoint-2010-social-networkingpart-3.html
Under section:"Timer Jobs Required"
The following are listed in the webpart:
Rating, blog, tag, like, ..
Activity Feeds are an ongoing record of a user’s activities through the day (or for whatever time period in which they choose to update the feed). There are two sections of Activity feed.
· My Activities - My Profile > Recent Activities
· Consolidated - My Newsfeed (Activities which track)
These two sections are like two sides of a conversation. Both are depending on Activity Feed timer job.
Kr, Gokan
Reply 2
Only the following activities will be displayed in the recent activities.
Rating, Tagging, new blog post and so on.
http://blogs.msdn.com/b/spses/archive/2011/02/05/social-computing-part-3-activity-feeds-social-ratings-tags-and-notes.aspx
Wayne Fan
Wednesday, December 7, 2011
How to exclude items from Search Result page?
in sharepoint 2010, there is an option to remove a url from search results immidiately, corresponding crawling rules/ exclude rules are set automatically
And the that specific content does not get crawled.
Otherwise go for Crawl exclude rules directly.
And the that specific content does not get crawled.
Otherwise go for Crawl exclude rules directly.
Tuesday, August 9, 2011
The user does not exist or is not unique FBA while adding AdGroup to siteGroup SharePoint 2010
Hi
I tried to add an ADGroup/FBARole to site group . In 2 ways:
1 is AddUser(SPUser user);
2nd is AddUser(string loginName, string email, string name, string notes)
code for 1st option:
SPUser cntrSubSiteUser = CreateUser(Constants.C_FBA_AUTHENTICATION_GROUP_PREFIX + RoleProvider + Constants.C_AUTHENTICATION_PIPE + ADgroup, "", ADgroup, "", web.Site);//loginname in format in format c:0-.f|roleproviderName|pp 1001 siteGroup.AddUser(cntrSubSiteUser);
siteGroup.Update();
and the createuser function is like;
private static SPUser CreateUser(string strLoginName, string strEMail, string strName, string strNotes, SPSite spSite) { SPUser spReturn = null; SPRoleAssignment spRoleAssignment = new SPRoleAssignment(strLoginName, strEMail, strName, strNotes); SPRoleDefinition spSPRoleDefinition = spSite.RootWeb.RoleDefinitions["Read"]; spRoleAssignment.RoleDefinitionBindings.Add(spSPRoleDefinition); spSite.RootWeb.RoleAssignments.Add(spRoleAssignment); //Update site spSite.RootWeb.Update(); spReturn = spSite.RootWeb.AllUsers[strLoginName]; return spReturn; }
for the second option code is like:- siteGroup.AddUser(Constants.C_FBA_AUTHENTICATION_GROUP_PREFIX + RoleProvider + Constants.C_AUTHENTICATION_PIPE + ADgroup, "", ADgroup, "");//Login Name in format c:0-.f|amsurgrole|pp 1001
siteGroup.Update();
Now lets come to the problem:
On 1 of our dev servers it works fine. But on production we get the error: The user does not exist or is not unique
However by UI, We can add this FBA Role to any group.
please help.
hi
we have got the solution.
we are adding user in group for site 1( on web app 1) from site 2 ( on web app 2) code. web app 1 is FBA . site 2 is normal windows site.
in 2007 this code works fine
but for sharepoint 2010, we need to give entries for roleprovider and membership provider in web application 2 (admin web app) web.config also.
I am also getting the same exception. I am doing everything on a single sharepoint application
[SPException: The user does not exist or is not unique.]
Can you please point out, what are the other scenarios for the exception to happen?
Reply 1.1.1
did u also do ensure user ? also make sure user exists in ad/ ur membership provider
Reply 1.1.1.1
when extending the application it named the membership provider wrongly, hence the error is caused. Thanks for all the replies. Now the problem is solved.
I tried to add an ADGroup/FBARole to site group . In 2 ways:
1 is AddUser(SPUser user);
2nd is AddUser(string loginName, string email, string name, string notes)
code for 1st option:
SPUser cntrSubSiteUser = CreateUser(Constants.C_FBA_AUTHENTICATION_GROUP_PREFIX + RoleProvider + Constants.C_AUTHENTICATION_PIPE + ADgroup, "", ADgroup, "", web.Site);//loginname in format in format c:0-.f|roleproviderName|pp 1001 siteGroup.AddUser(cntrSubSiteUser);
siteGroup.Update();
and the createuser function is like;
private static SPUser CreateUser(string strLoginName, string strEMail, string strName, string strNotes, SPSite spSite) { SPUser spReturn = null; SPRoleAssignment spRoleAssignment = new SPRoleAssignment(strLoginName, strEMail, strName, strNotes); SPRoleDefinition spSPRoleDefinition = spSite.RootWeb.RoleDefinitions["Read"]; spRoleAssignment.RoleDefinitionBindings.Add(spSPRoleDefinition); spSite.RootWeb.RoleAssignments.Add(spRoleAssignment); //Update site spSite.RootWeb.Update(); spReturn = spSite.RootWeb.AllUsers[strLoginName]; return spReturn; }
for the second option code is like:- siteGroup.AddUser(Constants.C_FBA_AUTHENTICATION_GROUP_PREFIX + RoleProvider + Constants.C_AUTHENTICATION_PIPE + ADgroup, "", ADgroup, "");//Login Name in format c:0-.f|amsurgrole|pp 1001
siteGroup.Update();
Now lets come to the problem:
On 1 of our dev servers it works fine. But on production we get the error: The user does not exist or is not unique
However by UI, We can add this FBA Role to any group.
please help.
Reply 1
hi
we have got the solution.
we are adding user in group for site 1( on web app 1) from site 2 ( on web app 2) code. web app 1 is FBA . site 2 is normal windows site.
in 2007 this code works fine
but for sharepoint 2010, we need to give entries for roleprovider and membership provider in web application 2 (admin web app) web.config also.
Reply 1.1
I am also getting the same exception. I am doing everything on a single sharepoint application
[SPException: The user does not exist or is not unique.]
Can you please point out, what are the other scenarios for the exception to happen?
Reply 1.1.1
did u also do ensure user ? also make sure user exists in ad/ ur membership provider
Reply 1.1.1.1
when extending the application it named the membership provider wrongly, hence the error is caused. Thanks for all the replies. Now the problem is solved.
Tuesday, June 21, 2011
Few of the SharePoint Sites not accessible outside server
Hi
Few of my sharepoint sirtes do not open outside the server. Others are working fine. Did you faced such issue in past ?
I verified almost every setting . All the settings on both type of web applications are same.
Reply :
It was due to firewall settings on the server.
Few of my sharepoint sirtes do not open outside the server. Others are working fine. Did you faced such issue in past ?
I verified almost every setting . All the settings on both type of web applications are same.
Reply :
It was due to firewall settings on the server.
Tuesday, June 14, 2011
SharePoint disable loopback check | Specify Host Names
A number of errors related to authentication failure are reported with SharePoint 20xx
You can try disable loopback check or Specify host names based on how much you can compromise on security front.
Method 1: Specify host names (Preferred method if NTLM authentication is desired)
To specify the host names that are mapped to the loopback address and can connect to Web sites on your computer, follow these steps:
DisableStrictNameChecking
registry entry to 1.
2. Click Start, click Run, type regedit, and then click OK.
3. In Registry Editor, locate and then click the following registry key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0
4. Right-click MSV1_0, point to New, and then click Multi-String Value.
5. Type BackConnectionHostNames, and then press ENTER.
6. Right-click BackConnectionHostNames, and then click Modify.
7. In the Value data box, type the host name or the host names for the sites that are on the local computer, and then click OK.
8. Quit Registry Editor, and then restart the IISAdmin service.
Method 2: Disable the loopback check (less-recommended method)
The second method is to disable the loopback check by setting the DisableLoopbackCheck registry key.
To set the DisableLoopbackCheck registry key, follow these steps:
1. Set the
DisableStrictNameChecking
registry entry to 1.
2. Click Start, click Run, type regedit, and then click OK.
3. In Registry Editor, locate and then click the following registry key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa
4. Right-click Lsa, point to New, and then click DWORD Value.
5. Type DisableLoopbackCheck, and then press ENTER.
6. Right-click DisableLoopbackCheck, and then click Modify.
7. In the Value data box, type 1, and then click OK.
8. Quit Registry Editor, and then restart your computer.
Reference :http://support.microsoft.com/kb/896861
You can try disable loopback check or Specify host names based on how much you can compromise on security front.
Method 1: Specify host names (Preferred method if NTLM authentication is desired)
To specify the host names that are mapped to the loopback address and can connect to Web sites on your computer, follow these steps:
- Set the
DisableStrictNameChecking
registry entry to 1.
2. Click Start, click Run, type regedit, and then click OK.
3. In Registry Editor, locate and then click the following registry key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0
4. Right-click MSV1_0, point to New, and then click Multi-String Value.
5. Type BackConnectionHostNames, and then press ENTER.
6. Right-click BackConnectionHostNames, and then click Modify.
7. In the Value data box, type the host name or the host names for the sites that are on the local computer, and then click OK.
8. Quit Registry Editor, and then restart the IISAdmin service.
Method 2: Disable the loopback check (less-recommended method)
The second method is to disable the loopback check by setting the DisableLoopbackCheck registry key.
To set the DisableLoopbackCheck registry key, follow these steps:
1. Set the
DisableStrictNameChecking
registry entry to 1.
2. Click Start, click Run, type regedit, and then click OK.
3. In Registry Editor, locate and then click the following registry key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa
4. Right-click Lsa, point to New, and then click DWORD Value.
5. Type DisableLoopbackCheck, and then press ENTER.
6. Right-click DisableLoopbackCheck, and then click Modify.
7. In the Value data box, type 1, and then click OK.
8. Quit Registry Editor, and then restart your computer.
or$regKeyPath = "HKLM:\System\CurrentControlSet\Control\Lsa"
$key = "DisableLoopbackCheck"
New-ItemProperty -Path $regKeyPath -Name $key -Value "1" -PropertyType dword
Reference :http://support.microsoft.com/kb/896861
Friday, June 10, 2011
refer unsigned assembly in SharePoint 2010 Project ( Visual Studio 2010)
I have around 50 3rd party dll's which I need to refer in my SharePoint project.
But since my project dll is strong named we were unable to refer unsigned dll's in it.
I tried below mentioned things:
1. removed signing of my dll from project properties. Project is build But in this case xml template of the package fails .The error I get while package creation is :
Value cannot be null. Parameter name: PublicKey
2. I tried below mentioned commands to strong name all the 3rd party dlls :
ildasm myDLL.dll /out:myDLL.il
This generates myDLL.il and myDLL.res
ilasm myDLL.il /key:Key.snk /res:myDLL.res /dll /out:myDLL.dll
This generates back strong named DLL.
But after this few of the namespaces get missing in the final DLL !!!!! well to my surprise .
3. I created a blank class library project . Given predefined structure to deploy 3rd party dll ( 80\bin) , with user controls inside proper structure as per wspbuilder guidelines. given the output path of my project dll as (80\bin).
Now I have a wsp ready and working being deployed . But neither my project dll is strong named nor the third party DLLs. dlls are deployed in web application bin and user controls inside proper control template folders . They work fine . but …
Now I come to my query:
I need to strong name my project dll still use 3rd party unsigned dll's inside my SharePoint project very similar to point 2 above.
Kindly suggest something.
Reply 1 By http://social.technet.microsoft.com/profile/martin%20hatch/?ws=usercard-mini
Ask the 3rd party to provide properly signed assemblies?
Reply 2 By http://social.technet.microsoft.com/profile/geoff%20webber-cross/?ws=usercard-mini
Might be a good option to wrap your business logic up that uses the DLLs in a WCF service and run it outside SharePoint, then you can call these methods safely from inside SharePoint (are you writing web parts?).
Reply 3 By http://social.technet.microsoft.com/profile/ryan%20t%20mann/?ws=usercard-mini
1. Use IlDasm to disassemble the DLL to an .il File
2. Then use IlAsm to reassemble it passing in a new key generated with the sn command line utility to generate strong names.
Make sure you use the .Net 3.5 versions of ILDasm and ILAsm or it will reassermble the Dll for the wrong framework, sharepoint 2010 stuff is .Net 3.5
The downside is you'll have to do that everytime a new version comes around.
This is how I got the .Net 3.5 version of the AJAX Control Toolkit to work in sharepoint 2010.
Heres a pretty in depth article that even covers signing DLL's that reference each other.
http://www.geekbeing.com/2010/01/30/sign-me-up-scotty-signing-managed-assemblies-with-ildasm-and-ilasm-duo/
My Blog: http://www.thesug.org/Blogs/ryan_mann1/default.aspx Website: Under Construction
But since my project dll is strong named we were unable to refer unsigned dll's in it.
I tried below mentioned things:
1. removed signing of my dll from project properties. Project is build But in this case xml template of the package fails .The error I get while package creation is :
Value cannot be null. Parameter name: PublicKey
2. I tried below mentioned commands to strong name all the 3rd party dlls :
ildasm myDLL.dll /out:myDLL.il
This generates myDLL.il and myDLL.res
ilasm myDLL.il /key:Key.snk /res:myDLL.res /dll /out:myDLL.dll
This generates back strong named DLL.
But after this few of the namespaces get missing in the final DLL !!!!! well to my surprise .
3. I created a blank class library project . Given predefined structure to deploy 3rd party dll ( 80\bin) , with user controls inside proper structure as per wspbuilder guidelines. given the output path of my project dll as (80\bin).
Now I have a wsp ready and working being deployed . But neither my project dll is strong named nor the third party DLLs. dlls are deployed in web application bin and user controls inside proper control template folders . They work fine . but …
Now I come to my query:
I need to strong name my project dll still use 3rd party unsigned dll's inside my SharePoint project very similar to point 2 above.
Kindly suggest something.
Reply 1 By http://social.technet.microsoft.com/profile/martin%20hatch/?ws=usercard-mini
Ask the 3rd party to provide properly signed assemblies?
Reply 2 By http://social.technet.microsoft.com/profile/geoff%20webber-cross/?ws=usercard-mini
Might be a good option to wrap your business logic up that uses the DLLs in a WCF service and run it outside SharePoint, then you can call these methods safely from inside SharePoint (are you writing web parts?).
Reply 3 By http://social.technet.microsoft.com/profile/ryan%20t%20mann/?ws=usercard-mini
1. Use IlDasm to disassemble the DLL to an .il File
2. Then use IlAsm to reassemble it passing in a new key generated with the sn command line utility to generate strong names.
Make sure you use the .Net 3.5 versions of ILDasm and ILAsm or it will reassermble the Dll for the wrong framework, sharepoint 2010 stuff is .Net 3.5
The downside is you'll have to do that everytime a new version comes around.
This is how I got the .Net 3.5 version of the AJAX Control Toolkit to work in sharepoint 2010.
Heres a pretty in depth article that even covers signing DLL's that reference each other.
http://www.geekbeing.com/2010/01/30/sign-me-up-scotty-signing-managed-assemblies-with-ildasm-and-ilasm-duo/
My Blog: http://www.thesug.org/Blogs/ryan_mann1/default.aspx Website: Under Construction
Saturday, May 28, 2011
Analyse event logs for Service Control Manager activities from windowsservices
Sometime you might want to start and stop kind of activities out of event logs for windows services . here is powershell script for this
Now that you have decided the culprit windows service, use this script to get whole available history:
Might be the case , you only want to list down which service is stopped and which one is active :
get last app pool recycle timings
$eventL = Get-EventLog -LogName "System" -Source "Service Control Manager" ;
Get-Service | ForEach-Object {
$st1 = "";
$st2 = "";
$st3 = "";
$st1 = $_.Status;
$st2 = $_.DisplayName;
$st3 = $_.Name;
#Write-Host $st1 $st2 $st3 -foregroundcolor cyan;
$eventL | where { $_.Message.Contains($st2) -eq "true" } | Select-Object -First 1 | ForEach-Object {
Write-Host $st1 $st2 $st3 -foregroundcolor cyan;
$st4 = "";
$st5 = "";
$st4 = $_.Message;
$st5 = $_.TimeGenerated;
Write-Host $st4 $st5;
}
}
$eventL = $null;
Now that you have decided the culprit windows service, use this script to get whole available history:
$eventL = Get-EventLog -LogName "System" -Source "Service Control Manager" ;
Get-Service | ForEach-Object {
if($_.Name -eq "AAAAAAAAAAAA"){
$st1 = "";
$st2 = "";
$st3 = "";
$st1 = $_.Status;
$st2 = $_.DisplayName;
$st3 = $_.Name;
#Write-Host $st1 $st2 $st3 -foregroundcolor cyan;
$eventL | where { $_.Message.Contains($st2) -eq "true" } | ForEach-Object {
#Write-Host $st1 $st2 $st3 -foregroundcolor cyan;
$st4 = "";
$st5 = "";
$st4 = $_.Message;
$st5 = $_.TimeGenerated;
Write-Host $st4 $st5;
}
}
}
$eventL = $null;
Might be the case , you only want to list down which service is stopped and which one is active :
Get-Service | ForEach-Object {
$st1 = "";
$st2 = "";
$st3 = "";
$st1 = $_.Status;
$st2 = $_.DisplayName;
$st3 = $_.Name;
Write-Host $st1 "," $st2 "," $st3 -foregroundcolor cyan;
}
You may also like:
get last app pool recycle timings
Wednesday, May 25, 2011
Multiple TargetPath under EcmDocumentRouterRule | EcmDocumentRouter , Content Organizer Rules , SharePoint 2010
In SharePoint 2010 with Content organizer Feature, we can route a document to the target based on predefined rules.
If multiple rules condition satisfy for current document being put in drop off library, priority of rule decides which rule will run.
My requirement is :
Either
1. Run multiple rules for single document so that same document may be routed to multiple targets.
Or
2. Under single rule define multiple targetpath so that single document may be routed to multiple locations base don predefined rules.
Reference :
http://msdn.microsoft.com/en-us/library/microsoft.office.recordsmanagement.recordsrepository.ecmdocumentrouterrule_properties.aspx
Reply 1 By http://social.technet.microsoft.com/profile/kefang%20chen/?ws=usercard-mini
Hi,
If you want to implement the requirement you mentioned, it is not necessary to use the Content Organizer feature.
You can create an 'ItemAdded' event receiver for all the document libraries. After you uploaded document to library, you can call the method 'SPListItem.CopyTo()' to copy current document to destination.
For this topic you can see the following document.
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splistitem.copyto.aspx
Reply 1.1 By http://social.technet.microsoft.com/profile/mayur%20joshi/?ws=usercard-mini
Chen,
What if I want to avoid customization using Object Model. Can the content organizer then help in this. I have a similar requirement to this. I have location property which is multi value field. Based on the selections need to route the document to the appropriate folders. Can you please highlight how this can be achieved?
Thanks,
Mayur
Reply 1.1.1 By http://social.technet.microsoft.com/profile/hemantrhtk/?ws=usercard-mini
Mayur
In your case it is achivable out of box.
Define as much rules as much you have targets.
In the condition of each rule you can define, based on meta data field( which is your location ) route the document to desired target.
Reply 1.1.1.1 by http://social.technet.microsoft.com/profile/mayur%20joshi/?ws=usercard-mini
Hemant,
Wish that was the case, i cant set as much rules because numerous permutation and combination that can happen with the countries (its a multi choice field).
I have raised another thread located here explaining the entire scenario. Any help will be highly appreciated.
Thanks,
Mayur Joshi
If multiple rules condition satisfy for current document being put in drop off library, priority of rule decides which rule will run.
My requirement is :
Either
1. Run multiple rules for single document so that same document may be routed to multiple targets.
Or
2. Under single rule define multiple targetpath so that single document may be routed to multiple locations base don predefined rules.
Reference :
http://msdn.microsoft.com/en-us/library/microsoft.office.recordsmanagement.recordsrepository.ecmdocumentrouterrule_properties.aspx
Reply 1 By http://social.technet.microsoft.com/profile/kefang%20chen/?ws=usercard-mini
Hi,
If you want to implement the requirement you mentioned, it is not necessary to use the Content Organizer feature.
You can create an 'ItemAdded' event receiver for all the document libraries. After you uploaded document to library, you can call the method 'SPListItem.CopyTo()' to copy current document to destination.
For this topic you can see the following document.
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splistitem.copyto.aspx
Reply 1.1 By http://social.technet.microsoft.com/profile/mayur%20joshi/?ws=usercard-mini
Chen,
What if I want to avoid customization using Object Model. Can the content organizer then help in this. I have a similar requirement to this. I have location property which is multi value field. Based on the selections need to route the document to the appropriate folders. Can you please highlight how this can be achieved?
Thanks,
Mayur
Reply 1.1.1 By http://social.technet.microsoft.com/profile/hemantrhtk/?ws=usercard-mini
Mayur
In your case it is achivable out of box.
Define as much rules as much you have targets.
In the condition of each rule you can define, based on meta data field( which is your location ) route the document to desired target.
Reply 1.1.1.1 by http://social.technet.microsoft.com/profile/mayur%20joshi/?ws=usercard-mini
Hemant,
Wish that was the case, i cant set as much rules because numerous permutation and combination that can happen with the countries (its a multi choice field).
I have raised another thread located here explaining the entire scenario. Any help will be highly appreciated.
Thanks,
Mayur Joshi
Monday, May 16, 2011
Two exactly same strings fail while comparison in c# .Net
I had an input field which had a space , some browsers were giving different hex for space in these input fields.
Finally I found , a space may not be a space there are as much as 25 different representations for space in Hex.
.Replace((char)0xA0, ' ') worked but better way is using .Normalize(System.Text.NormalizationForm.FormKC)
Reference : http://msdn.microsoft.com/en-us/library/ebza6ck1(v=vs.80).aspx
and http://msdn.microsoft.com/en-us/library/system.text.normalizationform(v=vs.80).aspx
Finally I found , a space may not be a space there are as much as 25 different representations for space in Hex.
.Replace((char)0xA0, ' ') worked but better way is using .Normalize(System.Text.NormalizationForm.FormKC)
Reference : http://msdn.microsoft.com/en-us/library/ebza6ck1(v=vs.80).aspx
and http://msdn.microsoft.com/en-us/library/system.text.normalizationform(v=vs.80).aspx
Sunday, May 15, 2011
"Central Administration>General Application Settings>External Service Connections >Configure Send To Connections" code for this
This is the way we define a connection to a site where we would like to drop our documents.
Now in my case there could be hundreds of target sites created by code as and when required.
For each site created I want to write few lines of code which will do exactly what /_admin/OfficialFileAdmin.aspx page does.
So i want code for what /_admin/OfficialFileAdmin.aspx ( Central Administration>General Application Settings>External Service Connections >Configure Send To Connections) does.
just try out like:
SPWebApplication app = SPWebApplication.Lookup(new Uri("http://hemant1236"));
SPOfficialFileHost host = new SPOfficialFileHost(true);
host.OfficialFileUrl = new Uri("http://hemant1236/testsite1/_vti_bin/officialfile.asmx");
host.OfficialFileName = "hemant1236Test1saurabh";
host.ShowOnSendToMenu = true;
host.Action = SPOfficialFileAction.Move;
host.Explanation = "created at Time" + DateTime.Now.ToString() + " by custom utility.";
app.OfficialFileHosts.Add(host);
app.Update();
Now in my case there could be hundreds of target sites created by code as and when required.
For each site created I want to write few lines of code which will do exactly what /_admin/OfficialFileAdmin.aspx page does.
So i want code for what /_admin/OfficialFileAdmin.aspx ( Central Administration>General Application Settings>External Service Connections >Configure Send To Connections) does.
just try out like:
SPWebApplication app = SPWebApplication.Lookup(new Uri("http://hemant1236"));
SPOfficialFileHost host = new SPOfficialFileHost(true);
host.OfficialFileUrl = new Uri("http://hemant1236/testsite1/_vti_bin/officialfile.asmx");
host.OfficialFileName = "hemant1236Test1saurabh";
host.ShowOnSendToMenu = true;
host.Action = SPOfficialFileAction.Move;
host.Explanation = "created at Time" + DateTime.Now.ToString() + " by custom utility.";
app.OfficialFileHosts.Add(host);
app.Update();
Friday, May 13, 2011
Name cannot begin with the '\' character, hexadecimal value 0x5C
Hi
While extending a claim based web application I get the error :
Name cannot begin with the '\' character, hexadecimal value 0x5C. Line 858, position 42.
Troubleshoot issues with Microsoft SharePoint Foundation.
Correlation ID: b2bdf10b-33d2-4630-8bab-8054c6ce310c
Date and Time: 5/13/2011 3:16:10 AM
any idea why it happen so .
In the log:
05/13/2011 04:03:37.57 w3wp.exe (0x0954) 0x1A00 SharePoint Foundation Runtime tkau Unexpected System.Xml.XmlException: Name cannot begin with the '\' character, hexadecimal value 0x5C. Line 858, position 42. at System.Xml.XmlTextReaderImpl.Throw(Exception e) at System.Xml.XmlTextReaderImpl.ParseAttributes() at System.Xml.XmlTextReaderImpl.ParseElement() at System.Xml.XmlTextReaderImpl.ParseElementContent() at System.Xml.XmlLoader.LoadNode(Boolean skipOverWhitespace) at System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc) at System.Xml.XmlDocument.Load(XmlReader reader) at System.Xml.XmlDocument.Load(String filename) at Microsoft.SharePoint.Administration.SPAspConfigurationFile.ApplyZoneSettingsToWebConfig(Uri responseUri, SPIisSettings settings) at Microsoft.SharePoint.Administration.SPWebApplication.Provision() at Microsoft.SharePo... 16bc3d6e-05e4-45d0-984c-813ed7e0c515
05/13/2011 04:03:37.57* w3wp.exe (0x0954) 0x1A00 SharePoint Foundation Runtime tkau Unexpected ...int.ApplicationPages.ExtendWebFarmPage.BtnSubmit_Click(Object sender, EventArgs e) at System.Web.UI.WebControls.Button.OnClick(EventArgs e) at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) 16bc3d6e-05e4-45d0-984c-813ed7e0c515
While extending a claim based web application I get the error :
Name cannot begin with the '\' character, hexadecimal value 0x5C. Line 858, position 42.
Troubleshoot issues with Microsoft SharePoint Foundation.
Correlation ID: b2bdf10b-33d2-4630-8bab-8054c6ce310c
Date and Time: 5/13/2011 3:16:10 AM
any idea why it happen so .
In the log:
05/13/2011 04:03:37.57 w3wp.exe (0x0954) 0x1A00 SharePoint Foundation Runtime tkau Unexpected System.Xml.XmlException: Name cannot begin with the '\' character, hexadecimal value 0x5C. Line 858, position 42. at System.Xml.XmlTextReaderImpl.Throw(Exception e) at System.Xml.XmlTextReaderImpl.ParseAttributes() at System.Xml.XmlTextReaderImpl.ParseElement() at System.Xml.XmlTextReaderImpl.ParseElementContent() at System.Xml.XmlLoader.LoadNode(Boolean skipOverWhitespace) at System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc) at System.Xml.XmlDocument.Load(XmlReader reader) at System.Xml.XmlDocument.Load(String filename) at Microsoft.SharePoint.Administration.SPAspConfigurationFile.ApplyZoneSettingsToWebConfig(Uri responseUri, SPIisSettings settings) at Microsoft.SharePoint.Administration.SPWebApplication.Provision() at Microsoft.SharePo... 16bc3d6e-05e4-45d0-984c-813ed7e0c515
05/13/2011 04:03:37.57* w3wp.exe (0x0954) 0x1A00 SharePoint Foundation Runtime tkau Unexpected ...int.ApplicationPages.ExtendWebFarmPage.BtnSubmit_Click(Object sender, EventArgs e) at System.Web.UI.WebControls.Button.OnClick(EventArgs e) at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) 16bc3d6e-05e4-45d0-984c-813ed7e0c515
Reply 1
In the app keys for main web application which is being extended; there was a key which referred a shared location like : "\\hemant1236\dropOff". The characters \\ in this app keys were the culprit. When I commented out this key , the web application was able to extend successfully.
Tuesday, April 19, 2011
get last app pool recycle timings
c:\Windows\System32\inetsrv\appcmd list wp gives you all the process IDs
and on powershell go for :
(Get-Process -Id [processID]).StartTime
You may also like:
Analyse event logs for Service Control Manager activities from windows
and on powershell go for :
(Get-Process -Id [processID]).StartTime
You may also like:
Analyse event logs for Service Control Manager activities from windows
Sunday, April 17, 2011
Search History in SharePoint 2010
Did anyone got a chance to work on Search History?
We are able to get top Search Queries , but we need to maintain log of all search keywords entered by all the users. Is there something out of box for this?
Reply 1
here are some default Search Reports, but i do not recall it does keep track ALL the search keywords entered by user, the closest
You may refer http://blogs.msdn.com/b/ecm/archive/2010/05/03/web-analytics-in-sharepoint-2010-insights-into-reports-and-metrics.aspx for more information about the default search report.
Reply 1,1 we have tried it dear but we need to track all.Please help.Track all search keywords entered to be very specific .
Reply 1.1.1 You can create a hidden web part, place the hidden web part in the Search Result page, and the web part will retrieve the HTTP GET parameter, q=keyword, store it to a search keyword table, and make a report out of that table.
Kiat Hau, Goh http://kiatsplayground.blogspot.com/
Reply 1.1.1.1 If there is nothing out of box in SharePoint 2010 for this , we will go for omniture - its just similar to google analytic .
We are able to get top Search Queries , but we need to maintain log of all search keywords entered by all the users. Is there something out of box for this?
Reply 1
here are some default Search Reports, but i do not recall it does keep track ALL the search keywords entered by user, the closest
You may refer http://blogs.msdn.com/b/ecm/archive/2010/05/03/web-analytics-in-sharepoint-2010-insights-into-reports-and-metrics.aspx for more information about the default search report.
Reply 1,1 we have tried it dear but we need to track all.Please help.Track all search keywords entered to be very specific .
Reply 1.1.1 You can create a hidden web part, place the hidden web part in the Search Result page, and the web part will retrieve the HTTP GET parameter, q=keyword, store it to a search keyword table, and make a report out of that table.
Kiat Hau, Goh http://kiatsplayground.blogspot.com/
Reply 1.1.1.1 If there is nothing out of box in SharePoint 2010 for this , we will go for omniture - its just similar to google analytic .
Friday, April 15, 2011
SharePoint 2010 with IE 9
Hi
In IE 8 we used to have a load bar in the browser . But in IE 9 when the page is loading a circle keeps on moving in the address bar-tab area.
I have a question now for my SharePoint site.
after the circle in the address bar – tab has stopped rotating and when the page actually comes to the screen , there is a difference of 7 seconds!!!!!
If you have concrete explanation for this or something like a wild guess please reply down.
P.S. 1 The issue is with latest version of IE 9 also downloaded today
P.S.2 One of the comment I got offline:
http://support.microsoft.com/kb/2398082
This issue can also occur if Internet Explorer 9 is running in Software Rendering mode.
By default, Internet Explorer 9 uses GPU Rendering mode. However, some outdated video cards and video drivers do not support GPU hardware acceleration. If Internet Explorer 9 determines that your current video card or video driver does not support GPU hardware acceleration, Internet Explorer 9 uses Software Rendering mode.
To determine whether Internet Explorer 9 is using Software Rendering mode, follow these steps:
Start Internet Explorer 9.
Click Internet Options on the Tools menu.
On the Advanced tab, locate the Accelerated graphics section.
Verify that the Use software rendering instead of GPU rendering check box is selected.
If this option is selected, Internet Explorer 9 is running in Software Rendering mode. If the option is greyed out, your current video card or video driver does not support GPU hardware acceleration.
Reply 1 http://social.technet.microsoft.com/profile/smidha/?ws=usercard-mini
I've experienced the same in Mozilla as well.
For IE9, also checked IE Options-> advanced -> Accelerated graphics section -> Use software rendering instead of GPU rendering check box is selected.
But no luck. A quick solution will be helpful.
In IE 8 we used to have a load bar in the browser . But in IE 9 when the page is loading a circle keeps on moving in the address bar-tab area.
I have a question now for my SharePoint site.
after the circle in the address bar – tab has stopped rotating and when the page actually comes to the screen , there is a difference of 7 seconds!!!!!
If you have concrete explanation for this or something like a wild guess please reply down.
P.S. 1 The issue is with latest version of IE 9 also downloaded today
P.S.2 One of the comment I got offline:
http://support.microsoft.com/kb/2398082
This issue can also occur if Internet Explorer 9 is running in Software Rendering mode.
By default, Internet Explorer 9 uses GPU Rendering mode. However, some outdated video cards and video drivers do not support GPU hardware acceleration. If Internet Explorer 9 determines that your current video card or video driver does not support GPU hardware acceleration, Internet Explorer 9 uses Software Rendering mode.
To determine whether Internet Explorer 9 is using Software Rendering mode, follow these steps:
Start Internet Explorer 9.
Click Internet Options on the Tools menu.
On the Advanced tab, locate the Accelerated graphics section.
Verify that the Use software rendering instead of GPU rendering check box is selected.
If this option is selected, Internet Explorer 9 is running in Software Rendering mode. If the option is greyed out, your current video card or video driver does not support GPU hardware acceleration.
Reply 1 http://social.technet.microsoft.com/profile/smidha/?ws=usercard-mini
I've experienced the same in Mozilla as well.
For IE9, also checked IE Options-> advanced -> Accelerated graphics section -> Use software rendering instead of GPU rendering check box is selected.
But no luck. A quick solution will be helpful.
Tuesday, February 22, 2011
User's Role Specific Theme - SharePoint 2010
e are digging out the possibility to give user's role specific themes in SharePoint 2010.
We are OK with going for custom coding for this.
Do you have any clues how to achieve this?
so based on:
http://social.msdn.microsoft.com/Forums/en-US/sharepoint2010general/thread/bc5c26e8-4a84-4120-9f44-ffb83db73836
http://efreedom.com/Question/1-2640711/Dynamically-Adding-CSS-File-ASPNET-Server-Control
http://stackoverflow.com/questions/2153310/user-specific-theme-in-sharepoint
http://efreedom.com/Question/1-2640711/Dynamically-Adding-CSS-File-ASPNET-Server-Control
we are going to override css in our custom control referred in the master page
Reply 1 http://social.technet.microsoft.com/profile/ishaan%20puniani/?ws=usercard-mini
take a look at :
http://social.msdn.microsoft.com/Forums/en-US/sharepoint2010general/thread/bc5c26e8-4a84-4120-9f44-ffb83db73836
to make it light weight you can write only those classes that modifies the Look nd feel of the site in the CSS .
We are OK with going for custom coding for this.
Do you have any clues how to achieve this?
so based on:
http://social.msdn.microsoft.com/Forums/en-US/sharepoint2010general/thread/bc5c26e8-4a84-4120-9f44-ffb83db73836
http://efreedom.com/Question/1-2640711/Dynamically-Adding-CSS-File-ASPNET-Server-Control
http://stackoverflow.com/questions/2153310/user-specific-theme-in-sharepoint
http://efreedom.com/Question/1-2640711/Dynamically-Adding-CSS-File-ASPNET-Server-Control
we are going to override css in our custom control referred in the master page
Reply 1 http://social.technet.microsoft.com/profile/ishaan%20puniani/?ws=usercard-mini
take a look at :
http://social.msdn.microsoft.com/Forums/en-US/sharepoint2010general/thread/bc5c26e8-4a84-4120-9f44-ffb83db73836
to make it light weight you can write only those classes that modifies the Look nd feel of the site in the CSS .
Thursday, February 17, 2011
List Level backups for multiple sub sites -Poweshell
In SharePoint projects, there are scenarios, where a number of sub sites are created using a same template (now WSP).
We come across requirements where these templates require updation in due course of time. And hence the sub sites already created may require an update. But it is not feasible to go to each and every sub site created and make the changes.
So best way could be take backup of variable components ( Lists) and then recreate all the sub sites and then restore back the lists to the newly created sub sites.
The below mentioned PowerShell script can be used to take backup export the content from a specific named list in a shared folder structure, where each sub site will have a specific folder for backup in format cmp :
$mainBackuppath="\\abc2010\exportimport"
$File="export.txt"
Get-SPSite -Identity $spsite | Get-SPWeb -limit all| ForEach-Object {
if(($_.URL -eq $spsite+"/xyz") -or ($_.URL -eq $spsite+"") -or ($_.URL -eq $spsite+"/lmn") )
{
write-host -f Green "Skipping " $_.URL
"Skipping " + $_.URL | Out-File $File -append
}
else
{
write-host -f Green "processing for " $_.URL
"processing for " + $_.URL | Out-File $File -append
$currentSubSiteTitlewithoutspace= ""
$currentSubSiteTitlewithoutspace=$_.Title.Replace(" ","")
write-host -f Blue "Creating Directory: "$mainBackuppath"\"$currentSubSiteTitlewithoutspace
"Creating Directory: "+$mainBackuppath+"\"+$currentSubSiteTitlewithoutspace | Out-File $File -append
$error.clear()
[IO.Directory]::CreateDirectory($mainBackuppath+"\"+$currentSubSiteTitlewithoutspace)
if($error.count -gt 0){$error | out-file $File -append}
$filesystemPath=""
$filesystemPath = $mainBackuppath+"\"+$currentSubSiteTitlewithoutspace
if(Test-Path $filesystemPath)
{
$filesystemPath =$mainBackuppath+"\"+$currentSubSiteTitlewithoutspace+"\"+$currentSubSiteTitlewithoutspace+".cmp"
$DocLibPath=""
$DocLibPath= "/"+$_.Title+"/Shared Documents"
write-host -f Yellow "Taking Backup for "$DocLibPath " at location " $filesystemPath "...."
"Taking Backup for "+$DocLibPath +" at location "+ $filesystemPath +"...."| Out-File $File -append
$error.clear()
export-spweb -identity $_.URL -path $filesystemPath -ItemUrl $DocLibPath -Force -IncludeUserSecurity -IncludeVersions All | Out-File $File -append
if($error.count -gt 0){$error | out-file $File -append}
write-host -f Yellow "Backup for "$DocLibPath " at location " $filesystemPath "Completed."
"Backup for "+$DocLibPath +" at location "+ $filesystemPath +"Completed."| Out-File $File -append
}
else
{
write-host -f Red $filesystemPath " does not exist."
$filesystemPath +" does not exist." | Out-File $File -append
}
write-host -f Green "End of " $_.URL"`n`n`n`n"
"End of "+ $_.URL+"`n`n`n`n"| Out-File $File -append
}
}
The below mentioned PowerShell script can be used to restore backup /exported content shared folder structure, where each sub site will have a specific folder for backup in format cmp, to the subsites created using new template :
$spsite= "http://abc:1104"
$mainBackuppath="\\abc2010\exportimport"
$File="export.txt"
Get-SPSite -Identity $spsite | Get-SPWeb -limit all| ForEach-Object {
if(($_.URL -eq $spsite+"/xyz") -or ($_.URL -eq $spsite+"") -or ($_.URL -eq $spsite+"/lmn") )
{
write-host -f Green "Skipping " $_.URL
"Skipping " + $_.URL | Out-File $File -append
}
else
{
write-host -f Green "processing for " $_.URL
"processing for " + $_.URL | Out-File $File -append
$currentSubSiteTitlewithoutspace= ""
$currentSubSiteTitlewithoutspace=$_.Title.Replace(" ","")
write-host -f Blue "Checking if directory exist for current web"
"Checking if directory exist for current web" | Out-File $File -append
$filesystemPath=""
$filesystemPath =$mainBackuppath+"\"+$currentSubSiteTitlewithoutspace+"\"+$currentSubSiteTitlewithoutspace+".cmp"
if(Test-Path $filesystemPath)
{
$DocLibPath=""
$DocLibPath= "/"+$_.Title+"/Shared Documents"
write-host -f Yellow "Restoring Backup at "$DocLibPath " from " $filesystemPath "...."
"Restoring Backup at "+$DocLibPath +" from " +$filesystemPath +"...." | Out-File $File -append
$error.clear()
Import-SPWeb -Identity $_.URL -Path $filesystemPath -IncludeUserSecurity -Force -UpdateVersions Overwrite | Out-File $File -append
if($error.count -gt 0){$error | out-file $File -append}
write-host -f Yellow "Backup for "$DocLibPath " at location " $filesystemPath "Completed."
"Backup for "+$DocLibPath +" at location " +$filesystemPath +"Completed." | Out-File $File -append
}
else
{
write-host -f Red $filesystemPath " does not exist."
$filesystemPath +" does not exist." | Out-File $File -append
}
write-host -f Green "End of " $_.URL"`n`n`n`n"
"End of " +$_.URL+"`n`n`n`n" | Out-File $File -append
}
}
___________________________________________________________________________________________________________________
description of commands being used:
1. Get-SPSite : creates object for the spsite as given by identity parameter.
2. Get-SPWeb -limit all gets all the spweb in the site collection
3. Out-File $File –append : put entry in a log file.
4. write-host -f Green "processing for " $_.URL : to write a text on screen
5. $error.clear() : clears the current error
6. [IO.Directory]::CreateDirectory() : used to create a folder on the shared path
7. if($error.count -gt 0){$error | out-file $File –append : if the error count is greater than 0, that is logged in the log file.
8. Test-Path $filesystemPath : verifies if the folder has been created
9. export-spweb -identity $_.URL -path $filesystemPath -ItemUrl $DocLibPath -Force -IncludeUserSecurity -IncludeVersions All | Out-File $File –append
: the heart of all commands, which is actually creating the cmp file
10. Import-SPWeb -Identity $_.URL -Path $filesystemPath -IncludeUserSecurity -Force -UpdateVersions Overwrite | Out-File $File –append
: the heart of all commands, which is actually restoring the cmp file.
We come across requirements where these templates require updation in due course of time. And hence the sub sites already created may require an update. But it is not feasible to go to each and every sub site created and make the changes.
So best way could be take backup of variable components ( Lists) and then recreate all the sub sites and then restore back the lists to the newly created sub sites.
The below mentioned PowerShell script can be used to take backup export the content from a specific named list in a shared folder structure, where each sub site will have a specific folder for backup in format cmp :
$mainBackuppath="\\abc2010\exportimport"
$File="export.txt"
Get-SPSite -Identity $spsite | Get-SPWeb -limit all| ForEach-Object {
if(($_.URL -eq $spsite+"/xyz") -or ($_.URL -eq $spsite+"") -or ($_.URL -eq $spsite+"/lmn") )
{
write-host -f Green "Skipping " $_.URL
"Skipping " + $_.URL | Out-File $File -append
}
else
{
write-host -f Green "processing for " $_.URL
"processing for " + $_.URL | Out-File $File -append
$currentSubSiteTitlewithoutspace= ""
$currentSubSiteTitlewithoutspace=$_.Title.Replace(" ","")
write-host -f Blue "Creating Directory: "$mainBackuppath"\"$currentSubSiteTitlewithoutspace
"Creating Directory: "+$mainBackuppath+"\"+$currentSubSiteTitlewithoutspace | Out-File $File -append
$error.clear()
[IO.Directory]::CreateDirectory($mainBackuppath+"\"+$currentSubSiteTitlewithoutspace)
if($error.count -gt 0){$error | out-file $File -append}
$filesystemPath=""
$filesystemPath = $mainBackuppath+"\"+$currentSubSiteTitlewithoutspace
if(Test-Path $filesystemPath)
{
$filesystemPath =$mainBackuppath+"\"+$currentSubSiteTitlewithoutspace+"\"+$currentSubSiteTitlewithoutspace+".cmp"
$DocLibPath=""
$DocLibPath= "/"+$_.Title+"/Shared Documents"
write-host -f Yellow "Taking Backup for "$DocLibPath " at location " $filesystemPath "...."
"Taking Backup for "+$DocLibPath +" at location "+ $filesystemPath +"...."| Out-File $File -append
$error.clear()
export-spweb -identity $_.URL -path $filesystemPath -ItemUrl $DocLibPath -Force -IncludeUserSecurity -IncludeVersions All | Out-File $File -append
if($error.count -gt 0){$error | out-file $File -append}
write-host -f Yellow "Backup for "$DocLibPath " at location " $filesystemPath "Completed."
"Backup for "+$DocLibPath +" at location "+ $filesystemPath +"Completed."| Out-File $File -append
}
else
{
write-host -f Red $filesystemPath " does not exist."
$filesystemPath +" does not exist." | Out-File $File -append
}
write-host -f Green "End of " $_.URL"`n`n`n`n"
"End of "+ $_.URL+"`n`n`n`n"| Out-File $File -append
}
}
The below mentioned PowerShell script can be used to restore backup /exported content shared folder structure, where each sub site will have a specific folder for backup in format cmp, to the subsites created using new template :
$spsite= "http://abc:1104"
$mainBackuppath="\\abc2010\exportimport"
$File="export.txt"
Get-SPSite -Identity $spsite | Get-SPWeb -limit all| ForEach-Object {
if(($_.URL -eq $spsite+"/xyz") -or ($_.URL -eq $spsite+"") -or ($_.URL -eq $spsite+"/lmn") )
{
write-host -f Green "Skipping " $_.URL
"Skipping " + $_.URL | Out-File $File -append
}
else
{
write-host -f Green "processing for " $_.URL
"processing for " + $_.URL | Out-File $File -append
$currentSubSiteTitlewithoutspace= ""
$currentSubSiteTitlewithoutspace=$_.Title.Replace(" ","")
write-host -f Blue "Checking if directory exist for current web"
"Checking if directory exist for current web" | Out-File $File -append
$filesystemPath=""
$filesystemPath =$mainBackuppath+"\"+$currentSubSiteTitlewithoutspace+"\"+$currentSubSiteTitlewithoutspace+".cmp"
if(Test-Path $filesystemPath)
{
$DocLibPath=""
$DocLibPath= "/"+$_.Title+"/Shared Documents"
write-host -f Yellow "Restoring Backup at "$DocLibPath " from " $filesystemPath "...."
"Restoring Backup at "+$DocLibPath +" from " +$filesystemPath +"...." | Out-File $File -append
$error.clear()
Import-SPWeb -Identity $_.URL -Path $filesystemPath -IncludeUserSecurity -Force -UpdateVersions Overwrite | Out-File $File -append
if($error.count -gt 0){$error | out-file $File -append}
write-host -f Yellow "Backup for "$DocLibPath " at location " $filesystemPath "Completed."
"Backup for "+$DocLibPath +" at location " +$filesystemPath +"Completed." | Out-File $File -append
}
else
{
write-host -f Red $filesystemPath " does not exist."
$filesystemPath +" does not exist." | Out-File $File -append
}
write-host -f Green "End of " $_.URL"`n`n`n`n"
"End of " +$_.URL+"`n`n`n`n" | Out-File $File -append
}
}
___________________________________________________________________________________________________________________
description of commands being used:
1. Get-SPSite : creates object for the spsite as given by identity parameter.
2. Get-SPWeb -limit all gets all the spweb in the site collection
3. Out-File $File –append : put entry in a log file.
4. write-host -f Green "processing for " $_.URL : to write a text on screen
5. $error.clear() : clears the current error
6. [IO.Directory]::CreateDirectory() : used to create a folder on the shared path
7. if($error.count -gt 0){$error | out-file $File –append : if the error count is greater than 0, that is logged in the log file.
8. Test-Path $filesystemPath : verifies if the folder has been created
9. export-spweb -identity $_.URL -path $filesystemPath -ItemUrl $DocLibPath -Force -IncludeUserSecurity -IncludeVersions All | Out-File $File –append
: the heart of all commands, which is actually creating the cmp file
10. Import-SPWeb -Identity $_.URL -Path $filesystemPath -IncludeUserSecurity -Force -UpdateVersions Overwrite | Out-File $File –append
: the heart of all commands, which is actually restoring the cmp file.
Monday, November 15, 2010
Not able to login to Claims based auth. sweb apps in sharepoint 2010
Hi till yesterday I was able to login to claim based web apps in my sharepoint 2010 server. but today they are giving below mentioned error! even though classic mode auth web apps are running fine.
Nor it allow to activate /deactivate any fature to a site collection under claims based web app with same error in event log:
Please help.
error message in event viewer:
Log Name: Application
Source: Microsoft-SharePoint Products-SharePoint Foundation
Date: 10/8/2010 1:30:59 PM
Event ID: 8311
Task Category: Topology
Level: Error
Keywords:
User: SHAREPOINT2010\administrator
Computer: sharepoint2k8.sharepoint2010.com
Description:
An operation failed because the following certificate has validation errors:\n\nSubject Name: CN=SharePoint Security Token Service, OU=SharePoint, O=Microsoft, C=US\nIssuer Name: CN=SharePoint Root Authority, OU=SharePoint, O=Microsoft, C=US\nThumbprint: 85F230FF68A8107A14667844D6741A6C2199C60E\n\nErrors:\n\n UntrustedRoot: A certificate chain processed, but terminated in a root certificate which is not trusted by the trust provider.
NotTimeValid: A required certificate is not within its validity period when verifying against the current system clock or the timestamp in the signed file.
RevocationStatusUnknown: The revocation function was unable to check revocation for the certificate.
OfflineRevocation: The revocation function was unable to check revocation because the revocation server was offline.
.
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="Microsoft-SharePoint Products-SharePoint Foundation" Guid="{6FB7E0CD-52E7-47DD-997A-241563931FC2}" />
<EventID>8311</EventID>
<Version>14</Version>
<Level>2</Level>
<Task>13</Task>
<Opcode>0</Opcode>
<Keywords>0x4000000000000000</Keywords>
<TimeCreated SystemTime="2010-10-08T08:00:59.446924300Z" />
<EventRecordID>524180</EventRecordID>
<Correlation ActivityID="{87C3E3A1-1134-43A6-A06E-150BA71C73C8}" />
<Execution ProcessID="6052" ThreadID="1540" />
<Channel>Application</Channel>
<Computer>sharepoint2k8.sharepoint2010.com</Computer>
<Security UserID="S-1-5-21-2138102958-2007814619-3387492156-500" />
</System>
<EventData>
<Data Name="string0">CN=SharePoint Security Token Service, OU=SharePoint, O=Microsoft, C=US</Data>
<Data Name="string1">CN=SharePoint Root Authority, OU=SharePoint, O=Microsoft, C=US</Data>
<Data Name="string2">85F230FF68A8107A14667844D6741A6C2199C60E</Data>
<Data Name="string3">UntrustedRoot: A certificate chain processed, but terminated in a root certificate which is not trusted by the trust provider.
NotTimeValid: A required certificate is not within its validity period when verifying against the current system clock or the timestamp in the signed file.
RevocationStatusUnknown: The revocation function was unable to check revocation for the certificate.
OfflineRevocation: The revocation function was unable to check revocation because the revocation server was offline.
</Data>
</EventData>
</Event>
Reply1
Hi ,
Your certificate is no longer valid. Please visit below link for error details for certificate.
http://msdn.microsoft.com/en-us/library/system.security.cryptography.x509certificates.x509chainstatusflags.aspx
Please follow http://technet.microsoft.com/en-us/library/cc700843.aspx for troubleshooting
Pathik Rawal Blog: http://pathikhrawal.wordpress.com
Nor it allow to activate /deactivate any fature to a site collection under claims based web app with same error in event log:
Please help.
error message in event viewer:
Log Name: Application
Source: Microsoft-SharePoint Products-SharePoint Foundation
Date: 10/8/2010 1:30:59 PM
Event ID: 8311
Task Category: Topology
Level: Error
Keywords:
User: SHAREPOINT2010\administrator
Computer: sharepoint2k8.sharepoint2010.com
Description:
An operation failed because the following certificate has validation errors:\n\nSubject Name: CN=SharePoint Security Token Service, OU=SharePoint, O=Microsoft, C=US\nIssuer Name: CN=SharePoint Root Authority, OU=SharePoint, O=Microsoft, C=US\nThumbprint: 85F230FF68A8107A14667844D6741A6C2199C60E\n\nErrors:\n\n UntrustedRoot: A certificate chain processed, but terminated in a root certificate which is not trusted by the trust provider.
NotTimeValid: A required certificate is not within its validity period when verifying against the current system clock or the timestamp in the signed file.
RevocationStatusUnknown: The revocation function was unable to check revocation for the certificate.
OfflineRevocation: The revocation function was unable to check revocation because the revocation server was offline.
.
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="Microsoft-SharePoint Products-SharePoint Foundation" Guid="{6FB7E0CD-52E7-47DD-997A-241563931FC2}" />
<EventID>8311</EventID>
<Version>14</Version>
<Level>2</Level>
<Task>13</Task>
<Opcode>0</Opcode>
<Keywords>0x4000000000000000</Keywords>
<TimeCreated SystemTime="2010-10-08T08:00:59.446924300Z" />
<EventRecordID>524180</EventRecordID>
<Correlation ActivityID="{87C3E3A1-1134-43A6-A06E-150BA71C73C8}" />
<Execution ProcessID="6052" ThreadID="1540" />
<Channel>Application</Channel>
<Computer>sharepoint2k8.sharepoint2010.com</Computer>
<Security UserID="S-1-5-21-2138102958-2007814619-3387492156-500" />
</System>
<EventData>
<Data Name="string0">CN=SharePoint Security Token Service, OU=SharePoint, O=Microsoft, C=US</Data>
<Data Name="string1">CN=SharePoint Root Authority, OU=SharePoint, O=Microsoft, C=US</Data>
<Data Name="string2">85F230FF68A8107A14667844D6741A6C2199C60E</Data>
<Data Name="string3">UntrustedRoot: A certificate chain processed, but terminated in a root certificate which is not trusted by the trust provider.
NotTimeValid: A required certificate is not within its validity period when verifying against the current system clock or the timestamp in the signed file.
RevocationStatusUnknown: The revocation function was unable to check revocation for the certificate.
OfflineRevocation: The revocation function was unable to check revocation because the revocation server was offline.
</Data>
</EventData>
</Event>
Reply1
Hi ,
Your certificate is no longer valid. Please visit below link for error details for certificate.
http://msdn.microsoft.com/en-us/library/system.security.cryptography.x509certificates.x509chainstatusflags.aspx
Please follow http://technet.microsoft.com/en-us/library/cc700843.aspx for troubleshooting
Pathik Rawal Blog: http://pathikhrawal.wordpress.com
Thursday, October 21, 2010
custom actions on work flow suspended sharepoint 2010
Hi
I need few custom actions like sending emails and few logs update using enterprise library. What will be the best approach for this .
will SPWorkflowEventReceiver > WorkflowPostponed solve my pupose
if yes, is there any alternate solution possible?
Reply 1
Sending emails from the custom actions sounds like a custom application page to me.
SharePoint Solution Architect, Developer
I need few custom actions like sending emails and few logs update using enterprise library. What will be the best approach for this .
will SPWorkflowEventReceiver > WorkflowPostponed solve my pupose
if yes, is there any alternate solution possible?
Reply 1
Sending emails from the custom actions sounds like a custom application page to me.
SharePoint Solution Architect, Developer
Thursday, October 7, 2010
a primary AD group should not be added to a SharePoint Site Group.....
Hi
as per http://msdn.microsoft.com/en-us/library/bb975136%28office.12%29.aspx and the problem we are facing:
Primary group membership In Active Directory, each user has a primary group. When the LDAP Role provider is used with Active Directory, a user's primary group is not included in the list of roles for the user. By default, a user's primary group is the Domain Users group. As a result, the Domain Users group is not a good choice to add to a SharePoint group when you are provisioning permissions because unless the user's primary group is changed, no user is returned in the membership of that role. For more information, see the primaryGroupID attribute in User Security Attributes.
My requirement is:-
I have added user 'us1' in an ADGroup 'ADG1'. The ADGroup( via FBA ) is added to sharepoint site group "SiteGroup1" . The sharepoint site group "SiteGroup1" has 'view only' rights on a subsite in my Sharepoint portal - "Mysite1" .
Problem :
when user 'us1' tries to access my sub site "Mysite1" on my FBA portal,he is not authorized to access it .....
any clues how to get it working?
Reply 1
Hi,
Please grant SiteGroup1 ‘full control’ and try again.
If you get the same result, please check your FBA configuration settings.
Here is a useful article:
http://blogs.technet.com/b/speschka/archive/2009/11/05/configuring-forms-based-authentication-in-sharepoint-2010.aspx
Hope it is helpful!
Seven
Reply 1.1
Hi
its not about giving Full Control or view only.
suppose a user has rights on the site being part of an ad group, and this ad group is its primary group.
ad group is added to the sharepoint site group.
but as the link i had given, the user is not having rights as given by the sharepoint site group, since ladap does not retive this user under the given role, cause its through primary group as membership group in AD.
Reply 1.1.1
Hi,
From the link you given, the thing is that, only the domain users group will be unavailable to the SharePoint site since it is the default primary group. If you add this group to the SharePoint site, only the users who have changed the primary list will receive the role from this group in SharePoint site. For other primary groups you have set for some users, there is no this limitation.
If your need in your post is still not meted, please check your FBA configuration settings as I have mentioned.
Hope it is helpful!
Seven
Reply 1.1.1.1
Hey Seven you could replicate the exact scenario and verify what I meant here. I not pointing out specific Group who is Primary Group for all users by default.
Its like Primary AD Groups should not be used for providing rights. What I have understood till now . reason being if a user is member of a group and this group is also primary ad group for this user and if we add this primary group in a sharepoint site group, that's not done, user is still not having the intended rights!!!!
as per http://msdn.microsoft.com/en-us/library/bb975136%28office.12%29.aspx and the problem we are facing:
Primary group membership In Active Directory, each user has a primary group. When the LDAP Role provider is used with Active Directory, a user's primary group is not included in the list of roles for the user. By default, a user's primary group is the Domain Users group. As a result, the Domain Users group is not a good choice to add to a SharePoint group when you are provisioning permissions because unless the user's primary group is changed, no user is returned in the membership of that role. For more information, see the primaryGroupID attribute in User Security Attributes.
My requirement is:-
I have added user 'us1' in an ADGroup 'ADG1'. The ADGroup( via FBA ) is added to sharepoint site group "SiteGroup1" . The sharepoint site group "SiteGroup1" has 'view only' rights on a subsite in my Sharepoint portal - "Mysite1" .
Problem :
when user 'us1' tries to access my sub site "Mysite1" on my FBA portal,he is not authorized to access it .....
any clues how to get it working?
Reply 1
Hi,
Please grant SiteGroup1 ‘full control’ and try again.
If you get the same result, please check your FBA configuration settings.
Here is a useful article:
http://blogs.technet.com/b/speschka/archive/2009/11/05/configuring-forms-based-authentication-in-sharepoint-2010.aspx
Hope it is helpful!
Seven
Reply 1.1
Hi
its not about giving Full Control or view only.
suppose a user has rights on the site being part of an ad group, and this ad group is its primary group.
ad group is added to the sharepoint site group.
but as the link i had given, the user is not having rights as given by the sharepoint site group, since ladap does not retive this user under the given role, cause its through primary group as membership group in AD.
Reply 1.1.1
Hi,
From the link you given, the thing is that, only the domain users group will be unavailable to the SharePoint site since it is the default primary group. If you add this group to the SharePoint site, only the users who have changed the primary list will receive the role from this group in SharePoint site. For other primary groups you have set for some users, there is no this limitation.
If your need in your post is still not meted, please check your FBA configuration settings as I have mentioned.
Hope it is helpful!
Seven
Reply 1.1.1.1
Hey Seven you could replicate the exact scenario and verify what I meant here. I not pointing out specific Group who is Primary Group for all users by default.
Its like Primary AD Groups should not be used for providing rights. What I have understood till now . reason being if a user is member of a group and this group is also primary ad group for this user and if we add this primary group in a sharepoint site group, that's not done, user is still not having the intended rights!!!!
Monday, August 9, 2010
'Microsoft.SharePoint.IdentityModel.SPClaimsUtility' does not contain a definition for 'AuthenticateFormsUser'
Hi
I am trying to use SPClaimsUtility for au8thenticating my user as per http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.identitymodel.spclaimsutility.authenticateformsuser.aspx .
But I get error 'Microsoft.SharePoint.IdentityModel.SPClaimsUtility' does not contain a definition for 'AuthenticateFormsUser'
in my object browser for the 'Microsoft.SharePoint.IdentityModel.dll I am not able to find the def for this static function.
What could be the possible cause?
Cheers-hemant
we could not solve above problem but I used below mentioned code for FBA authentication finally:
Authenticate returns true or false according to user is authenticated or not .
private SecurityToken GetSecurityToken(string loginName,string psswrd)
{
return SPSecurityContext.SecurityTokenForFormsAuthentication(newUri(SPContext.Current.Site.Url),"memebershipprovidername","roleprovidername",loginName,psswrd);
}
private bool Authenticate(string loginName, string psswrd)
{
bool flag = false;
SecurityToken securityToken = null;
if (loginName==null && psswrd==null)
{
throw new ArgumentException("Please provide username and password");
}
using (new SPMonitoredScope("Retrieve security token and establish session."))
{
securityToken =
this.GetSecurityToken(loginName,psswrd);
if (securityToken == null)
{
flag =
false;
}
else
{
this.EstablishSessionWithToken(securityToken);
flag =
true;
}
}
return flag;
}
internal void EstablishSessionWithToken(SecurityToken securityToken)
{
if (securityToken == null)
{
throw new ArgumentNullException("securityToken");
}
Microsoft.SharePoint.IdentityModel.
SPFederationAuthenticationModule fam = this.Context.ApplicationInstance.Modules["FederatedAuthentication"] asMicrosoft.SharePoint.IdentityModel.SPFederationAuthenticationModule;
if (fam == null)
{
throw new ArgumentException(null, "FederationAuthenticationModule");
}
//Microsoft.SharePoint.Utilities
// .SecurityContext.RunAsProcess(delegate
//{
fam.SetPrincipalAndWriteSessionToken(securityToken,
true, SPSecurityTokenServiceManager.Local.UseSessionCookies);
//});
}
this function is not available in beta version of sharepoint 2010. in licensed version dll , the reference is there.
further the alternative code mentioned above has minor change wrt licensed version of new dll:
fam.SetPrincipalAndWriteSessionToken(securityToken);
instead of
fam.SetPrincipalAndWriteSessionToken(securityToken,
true, SPSecurityTokenServiceManager.Local.UseSessionCookies);
further we may like to have our own custom sign out:-
protected void lnkBtnSignOut_Click(object sender, EventArgs e)
{
HttpContext httpCntxt = HttpContext.Current;
//Signing out
FormsAuthentication.SignOut();
//Request.Cookies.Clear();
// nullifies current context
HttpContext.Current =
null;
//refills current context
HttpContext.Current = httpCntxt;
//abandons user's session
Session.Abandon();
//Clears authentication cookies if present
if (Response.Cookies.Count > 0)
{
if(Response.Cookies["FedAuth"] != null)
Response.Cookies[
"FedAuth"].Expires = DateTime.Now.AddDays(-1);
if (Response.Cookies[".ASPXAUTH"] != null)
Response.Cookies[
".ASPXAUTH"].Expires = DateTime.Now.AddDays(-1);
}
//Redirects to login page
FormsAuthentication.RedirectToLoginPage();
}
Reply 1 by http://social.technet.microsoft.com/profile/shantha%20kumar/?ws=usercard-mini
Hi,
This error occurs because of, you didn't have the Microsoft.SharePoint.IdentityModel.dll as a reference in your project.
If you need that, Search for that dll under installation drive (C:\Windows)
For me, that dll appears under (C:\Windows\Installer\$PatchCache$\Managed\00004109410100000100000000F01FEC\14.0.4763 )
Copy that dll and paste it some where, add this dll as a reference in your project.
I hope, this will help for you.
Shantha Kumar T - MCTS
I am trying to use SPClaimsUtility for au8thenticating my user as per http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.identitymodel.spclaimsutility.authenticateformsuser.aspx .
But I get error 'Microsoft.SharePoint.IdentityModel.SPClaimsUtility' does not contain a definition for 'AuthenticateFormsUser'
in my object browser for the 'Microsoft.SharePoint.IdentityModel.dll I am not able to find the def for this static function.
What could be the possible cause?
Cheers-hemant
we could not solve above problem but I used below mentioned code for FBA authentication finally:
Authenticate returns true or false according to user is authenticated or not .
private SecurityToken GetSecurityToken(string loginName,string psswrd)
{
return SPSecurityContext.SecurityTokenForFormsAuthentication(newUri(SPContext.Current.Site.Url),"memebershipprovidername","roleprovidername",loginName,psswrd);
}
private bool Authenticate(string loginName, string psswrd)
{
bool flag = false;
SecurityToken securityToken = null;
if (loginName==null && psswrd==null)
{
throw new ArgumentException("Please provide username and password");
}
using (new SPMonitoredScope("Retrieve security token and establish session."))
{
securityToken =
this.GetSecurityToken(loginName,psswrd);
if (securityToken == null)
{
flag =
false;
}
else
{
this.EstablishSessionWithToken(securityToken);
flag =
true;
}
}
return flag;
}
internal void EstablishSessionWithToken(SecurityToken securityToken)
{
if (securityToken == null)
{
throw new ArgumentNullException("securityToken");
}
Microsoft.SharePoint.IdentityModel.
SPFederationAuthenticationModule fam = this.Context.ApplicationInstance.Modules["FederatedAuthentication"] asMicrosoft.SharePoint.IdentityModel.SPFederationAuthenticationModule;
if (fam == null)
{
throw new ArgumentException(null, "FederationAuthenticationModule");
}
//Microsoft.SharePoint.Utilities
// .SecurityContext.RunAsProcess(delegate
//{
fam.SetPrincipalAndWriteSessionToken(securityToken,
true, SPSecurityTokenServiceManager.Local.UseSessionCookies);
//});
}
this function is not available in beta version of sharepoint 2010. in licensed version dll , the reference is there.
further the alternative code mentioned above has minor change wrt licensed version of new dll:
fam.SetPrincipalAndWriteSessionToken(securityToken);
instead of
fam.SetPrincipalAndWriteSessionToken(securityToken,
true, SPSecurityTokenServiceManager.Local.UseSessionCookies);
further we may like to have our own custom sign out:-
protected void lnkBtnSignOut_Click(object sender, EventArgs e)
{
HttpContext httpCntxt = HttpContext.Current;
//Signing out
FormsAuthentication.SignOut();
//Request.Cookies.Clear();
// nullifies current context
HttpContext.Current =
null;
//refills current context
HttpContext.Current = httpCntxt;
//abandons user's session
Session.Abandon();
//Clears authentication cookies if present
if (Response.Cookies.Count > 0)
{
if(Response.Cookies["FedAuth"] != null)
Response.Cookies[
"FedAuth"].Expires = DateTime.Now.AddDays(-1);
if (Response.Cookies[".ASPXAUTH"] != null)
Response.Cookies[
".ASPXAUTH"].Expires = DateTime.Now.AddDays(-1);
}
//Redirects to login page
FormsAuthentication.RedirectToLoginPage();
}
Reply 1 by http://social.technet.microsoft.com/profile/shantha%20kumar/?ws=usercard-mini
Hi,
This error occurs because of, you didn't have the Microsoft.SharePoint.IdentityModel.dll as a reference in your project.
If you need that, Search for that dll under installation drive (C:\Windows)
For me, that dll appears under (C:\Windows\Installer\$PatchCache$\Managed\00004109410100000100000000F01FEC\14.0.4763 )
Copy that dll and paste it some where, add this dll as a reference in your project.
I hope, this will help for you.
Shantha Kumar T - MCTS
Monday, July 5, 2010
SharePoint publishing behaviour related to expiration - approved documents not set to draft sometimes
Hi
query 1:-
Ours is a publishing portal. Max time it works, but there are instances when it does not work.
There are few documens in our doc library for which expiration date is less than current date, still they moderation status is approved!!!!
Could you please suggest what may be the reason for this ?
query 2:-
to expire few pages with our code, we shedule the page to current time + 1 minute by a timer job. max times it works fine, but there are few instances for which page file keep checked out by system account infinitely.sample code:-
/// <summary>
/// Expires the page by setting the Scheduled End Date to Current Time + 1 minute
/// </summary>
/// <param name="item">SPListItem that needs to be scheduled to expire</param>
/// <param name="pagesLibraryUrl">Pages Library URL in the Site Collection</param>
private static void ExpireExistingPage(SPListItem item)
{
try
{
ScheduledItem scheduledItem = null;
if (ScheduledItem.IsScheduledItem(item))
{
scheduledItem = ScheduledItem.GetScheduledItem(item);
if (scheduledItem.ListItem.Properties["PublishingExpirationDate"] == null || DateTime.Parse(scheduledItem.ListItem.Properties["PublishingExpirationDate"].ToString()) > DateTime.Now)
{
if (CheckOutPage(item.File))
{
scheduledItem.EndDate = DateTime.Now.AddMinutes(1);
scheduledItem.ListItem.Update();
scheduledItem.Schedule();
string expireSuccessfullMsg = string.Format(EXPIRE_SUCCESSFULLY_MSG, item.ContentType.Name, item.Title);
LogInFile(expireSuccessfullMsg, CommonEnums.LogEntryType.Information);
}
}
}
}
catch (Exception ex)
{
LogInFile(ex.Message, CommonEnums.LogEntryType.Exception);
}
}
Reply1 by http://social.technet.microsoft.com/profile/aryan30/?ws=usercard-mini
Hi Hemant,
Possible reason of some pages not expiring could be that you might have been setting the wrong time in End Date field and doing System Update after that.
Can you try by updating (using System Update)the end date in past say 1 day before and check whether sharepoint expires that page.
Another reason could be some particular field within sharepoint didn't got updated during updation of time (due to some async moss event or something like that).
Can you try by removing all other code from your code except setting of end date. Do you still find some pages which didn't expired?
Seems to be some trick of asynchronus moss events which are overlapping with each other. Trying giving sleep time b/w these events and check if Checked out error gets solved.Sleep time should vary from 1-4 secs.
query 1:-
Ours is a publishing portal. Max time it works, but there are instances when it does not work.
There are few documens in our doc library for which expiration date is less than current date, still they moderation status is approved!!!!
Could you please suggest what may be the reason for this ?
query 2:-
to expire few pages with our code, we shedule the page to current time + 1 minute by a timer job. max times it works fine, but there are few instances for which page file keep checked out by system account infinitely.sample code:-
/// <summary>
/// Expires the page by setting the Scheduled End Date to Current Time + 1 minute
/// </summary>
/// <param name="item">SPListItem that needs to be scheduled to expire</param>
/// <param name="pagesLibraryUrl">Pages Library URL in the Site Collection</param>
private static void ExpireExistingPage(SPListItem item)
{
try
{
ScheduledItem scheduledItem = null;
if (ScheduledItem.IsScheduledItem(item))
{
scheduledItem = ScheduledItem.GetScheduledItem(item);
if (scheduledItem.ListItem.Properties["PublishingExpirationDate"] == null || DateTime.Parse(scheduledItem.ListItem.Properties["PublishingExpirationDate"].ToString()) > DateTime.Now)
{
if (CheckOutPage(item.File))
{
scheduledItem.EndDate = DateTime.Now.AddMinutes(1);
scheduledItem.ListItem.Update();
scheduledItem.Schedule();
string expireSuccessfullMsg = string.Format(EXPIRE_SUCCESSFULLY_MSG, item.ContentType.Name, item.Title);
LogInFile(expireSuccessfullMsg, CommonEnums.LogEntryType.Information);
}
}
}
}
catch (Exception ex)
{
LogInFile(ex.Message, CommonEnums.LogEntryType.Exception);
}
}
Reply1 by http://social.technet.microsoft.com/profile/aryan30/?ws=usercard-mini
Hi Hemant,
Possible reason of some pages not expiring could be that you might have been setting the wrong time in End Date field and doing System Update after that.
Can you try by updating (using System Update)the end date in past say 1 day before and check whether sharepoint expires that page.
Another reason could be some particular field within sharepoint didn't got updated during updation of time (due to some async moss event or something like that).
Can you try by removing all other code from your code except setting of end date. Do you still find some pages which didn't expired?
Seems to be some trick of asynchronus moss events which are overlapping with each other. Trying giving sleep time b/w these events and check if Checked out error gets solved.Sleep time should vary from 1-4 secs.
Monday, June 21, 2010
Microsoft.SharePoint.WebPartPages.ToolPart , page needs a refresh to apply changes back to web part
Hi
I have a problem with custom tool part. The page needs a refresh before the changes are actually visible in the web part.
Either user have to hit apply then OK in Tool Part, or after directly hitting Ok he needs to refresh the page.
Seems to be create child control of web part being called before applychanges of tool part.
Any pointers ?
Reply 1
This is a common issue with custom properties in SharePoint webpart.
Just try call the method that modifies your custom property in the PreRender event.
For more check these links:
http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/6445d939-05da-4ce9-a2cf-3e9fe28b98ee
http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/5b85a5dc-37aa-49d7-a741-d40c7bd2bd0c
BR, PM
Reply 2
Hi
Thanks for you guidance,
I had to use a property from custom tool part to a script in the usercontrol( inside our web part).
calling my RegisterStartUpScript inside OnPreRender in user control solved my problem.
Thanks
Reply 3
Awesome news!!
BR, PM
I have a problem with custom tool part. The page needs a refresh before the changes are actually visible in the web part.
Either user have to hit apply then OK in Tool Part, or after directly hitting Ok he needs to refresh the page.
Seems to be create child control of web part being called before applychanges of tool part.
Any pointers ?
Reply 1
This is a common issue with custom properties in SharePoint webpart.
Just try call the method that modifies your custom property in the PreRender event.
For more check these links:
http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/6445d939-05da-4ce9-a2cf-3e9fe28b98ee
http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/5b85a5dc-37aa-49d7-a741-d40c7bd2bd0c
BR, PM
Reply 2
Hi
Thanks for you guidance,
I had to use a property from custom tool part to a script in the usercontrol( inside our web part).
calling my RegisterStartUpScript inside OnPreRender in user control solved my problem.
Thanks
Reply 3
Awesome news!!
BR, PM
Friday, June 11, 2010
How can i find the currently login user of extended web application through ASP.Net code?
i have created a web application http://spserver:19578 and then i extend a web application http://spserver:19579 from it.
Now i am currently login as ali to http://spserver:19579. i write the following code
SPSite sitecollection = new SPSite("http://spserver:19579");
SPWeb web = sitecollection.AllWebs["/"];
SPUser user = web.CurrentUser;
lblUser.Text = user.Name;
but it returns System Account. and when i used LoginName instead of Name then it returns SharePoint\system.
Note: I am using form based authentication in http://spserver:19579 and windows authentication in http://spserver:19578.
Reply 1
hey try using SPContext .Current .Web .CurrentUser
Now i am currently login as ali to http://spserver:19579. i write the following code
SPSite sitecollection = new SPSite("http://spserver:19579");
SPWeb web = sitecollection.AllWebs["/"];
SPUser user = web.CurrentUser;
lblUser.Text = user.Name;
but it returns System Account. and when i used LoginName instead of Name then it returns SharePoint\system.
Note: I am using form based authentication in http://spserver:19579 and windows authentication in http://spserver:19578.
Reply 1
hey try using SPContext .Current .Web .CurrentUser
thumbnail word, pdf, excel etc in wss 3.0
does anyone know of a way to create thumbnails for documents in sharepoint services? what i would like to happen is provide a new column that would allow the end user to hover a icon that would provide a 200X200 popup thumbnail. this would give my endusers a quick look at the doc with out having to open.
i tried this link but can't get it to work. it's date for 2005
http://msdn.microsoft.com/en-us/library/aa289172(VS.71).aspx
thanks for any help
reply 1
use aspose pdf kit
i tried this link but can't get it to work. it's date for 2005
http://msdn.microsoft.com/en-us/library/aa289172(VS.71).aspx
thanks for any help
reply 1
use aspose pdf kit
Friday, March 19, 2010
State Managements in .NET
State Management Techniques in ASP.NET
Developer is forced to implement various state management techniques when developing applications which provide customized content and which “remembers” the user.Here we are here with various options for ASP.NET developer to implement state management techniques in their applications. Broadly, we can classify state management techniques as client side state management or server side state management. Each technique has its own pros and cons. Let’s start with exploring client side state management options.
Client side State management Options:
ASP.NET provides various client side state management options like Cookies, QueryStrings (URL), Hidden fields, View State and Control state (ASP.NET 2.0). Let’s discuss each of client side state management options.
Bandwidth should be considered while implementing client side state management options because they involve in each roundtrip to server. Example: Cookies are exchanged between client and server for each page request.
Cookie:
A cookie is a small piece of text stored on user’s computer. Usually, information is stored as name-value pairs. Cookies are used by websites to keep track of visitors. Every time a user visits a website, cookies are retrieved from user machine and help identify the user.
Let’s see an example which makes use of cookies to customize web page.
if (Request.Cookies["UserId"] != null)
lbMessage.text = “Dear” + Request.Cookies["UserId"].Value + “, Welcome to our website!”;
else
lbMessage.text = “Guest,welcome to our website!”;
If you want to store client’s information use the below code
Response.Cookies["UserId"].Value=username;
Advantages:
* Simplicity
Disadvantages:
* Cookies can be disabled on user browsers
* Cookies are transmitted for each HTTP request/response causing overhead on bandwidth
* Inappropriate for sensitive data
Hidden fields:
Hidden fields are used to store data at the page level. As its name says, these fields are not rendered by the browser. It’s just like a standard control for which you can set its properties. Whenever a page is submitted to server, hidden fields values are also posted to server along with other controls on the page. Now that all the asp.net web controls have built in state management in the form of view state and new feature in asp.net 2.0 control state, hidden fields functionality seems to be redundant. We can still use it to store insignificant data. We can use hidden fields in ASP.NET pages using following syntax
protected System.Web.UI.HtmlControls.HtmlInputHidden Hidden1;
//to assigns a value to Hidden field
Hidden1.Value=”Create hidden fields”;
//to retrieves a value
string str=Hidden1.Value;
Advantages:
* Simple to implement for a page specific data
* Can store small amount of data so they take less size.
Disadvantages:
* Inappropriate for sensitive data
* Hidden field values can be intercepted(clearly visible) when passed over a network
View State:
View State can be used to store state information for a single user. View State is a built in feature in web controls to persist data between page post backs. You can set View State on/off for each control using EnableViewState property. By default, EnableViewState property will be set to true. View state mechanism poses performance overhead. View state information of all the controls on the page will be submitted to server on each post back. To reduce performance penalty, disable View State for all the controls for which you don’t need state. (Data grid usually doesn’t need to maintain state). You can also disable View State for the entire page by adding EnableViewState=false to @page directive. View state data is encoded as binary Base64 – encoded which add approximately 30% overhead. Care must be taken to ensure view state for a page is smaller in size. View State can be used using following syntax in an ASP.NET web page.
// Add item to ViewState
ViewState["myviewstate"] = myValue;
//Reading items from ViewState
Response.Write(ViewState["myviewstate"]);
Advantages:
* Simple for page level data
* Encrypted
* Can be set at the control level
Disadvantages:
* Overhead in encoding View State values
* Makes a page heavy
Query strings:
Query strings are usually used to send information from one page to another page. They are passed along with URL in clear text. Now that cross page posting feature is back in asp.net 2.0, Query strings seem to be redundant. Most browsers impose a limit of 255 characters on URL length. We can only pass smaller amounts of data using query strings. Since Query strings are sent in clear text, we can also encrypt query values. Also, keep in mind that characters that are not valid in a URL must be encoded using Server.UrlEncode.
Let’s assume that we have a Data Grid with a list of products, and a hyperlink in the grid that goes to a product detail page, it would be an ideal use of the Query String to include the product ID in the Query String of the link to the product details page (for example, productdetails.aspx?productid=4).
When product details page is being requested, the product information can be obtained by using the following codes:
string productid;
productid=Request.Params["productid"];
Advantages:
* Simple to Implement
Disadvantages:
* Human Readable
* Client browser limit on URL length
* Cross paging functionality makes it redundant
* Easily modified by end user
Control State:
Control State is new mechanism in ASP.NET 2.0 which addresses some of the shortcomings of View State. Control state can be used to store critical, private information across post backs. Control state is another type of state container reserved for controls to maintain their core behavioral functionality whereas View State only contains state to maintain control’s contents (UI). Control State shares same memory data structures with View State. Control State can be propagated even though the View State for the control is disabled. For example, new control Grid View in ASP.NET 2.0 makes effective use of control state to maintain the state needed for its core behavior across post backs. Grid View is in no way affected when we disable View State for the Grid View or entire page
Server Side State management:
As name implies, state information will be maintained on the server. Application, Session, Cache and Database are different mechanisms for storing state on the server.
Care must be taken to conserve server resources. For a high traffic web site with large number of concurrent users, usage
of sessions object for state management can create load on server causing performance degradation
Application object:
Application object is used to store data which is visible across entire application and shared across multiple user sessions. Data which needs to be persisted for entire life of application should be stored in application object.
In classic ASP, application object is used to store connection strings. It’s a great place to store data which changes infrequently. We should write to application variable only in application_Onstart event (global.asax) or application.lock event to avoid data conflicts. Below code sample gives idea
Application.Lock();
Application["mydata"]=”mydata”;
Application.UnLock();
Session object:
Session object is used to store state specific information per client basis. It is specific to particular user. Session data persists for the duration of user session you can store session’s data on web server in different ways. Session state can be configured using the section in the application’s web.config file.
Configuration information:
cookieless = <”true” | “false”>
timeout =
sqlconnectionstring =
server =
port =
Mode:
This setting supports three options. They are InProc, SQLServer, and State Server
Cookie less:
This setting takes a Boolean value of either true or false to indicate whether the Session is a cookie less one.
Timeout:
This indicates the Session timeout vale in minutes. This is the duration for which a user’s session is active. Note that the session timeout is a sliding value; Default session timeout value is 20 minutes
SqlConnectionString:
This identifies the database connection string that names the database used for mode SQLServer.
Server:
In the out-of-process mode State Server, it names the server that is running the required Windows NT service: aspnet_state.
Port:
This identifies the port number that corresponds to the server setting for mode State Server. Note that a port is an unsigned integer that uniquely identifies a process running over a network.
You can disable session for a page using EnableSessionState attribute. You can set off session for entire application by setting mode=off in web.config file to reduce overhead for the entire application.
Session state in ASP.NET can be configured in different ways based on various parameters including scalability, maintainability and availability
* In process mode (in-memory)- State information is stored in memory of web server
* Out-of-process mode- session state is held in a process called aspnet_state.exe that runs as a windows service.
* Database mode – session state is maintained on a SQL Server database.
In process mode:
This mode is useful for small applications which can be hosted on a single server. This model is most common and default method to store session specific information. Session data is stored in memory of local web server
Configuration information:
sqlConnectionString=”data source=server;user id=freelance;password=freelance”
cookieless=”false” timeout=”20″ />
Advantages:
* Fastest mode
* Simple configuration
Disadvantages:
* Session data will be lost if the worker process or application domain recycles
* Not ideal for web gardens and web farms
Out-of-process Session mode (state server mode):
This mode is ideal for scalable and highly available applications. Session state is held in a process called aspnet_state.exe that runs as a windows service which listens on TCP port 42424 by default. You can invoke state service using services MMC snap-in or by running following net command from command line.
Net start aspnet_state
Configuration information:
StateConnectionString=”tcpip=127.0.0.1:42424″
sqlConnectionString=”data source=127.0.0.1;user id=freelance; password=freelance”
cookieless=”false” timeout=”20″/>
Advantages:
* Supports web farm and web garden configuration
* Session data is persisted across application domain recycles. This is achieved by using separate worker process for maintaining state
Disadvantages:
* Out-of-process mode provides slower access compared to In process
* Requires serializing data
SQL-Backed Session state:
ASP.NET sessions can also be stored in a SQL Server database. Storing sessions in SQL Server offers resilience that can serve sessions to a large web farm that persists across IIS restarts.
SQL based Session state is configured with aspnet_regsql.exe. This utility is located in .NET Framework’s installed directory
C:\\microsoft.net\framework\. Running this utility will create a database which will manage the session state.
Configuration Information:
sqlConnectionString=”data source=server;user id=freelance;password=freelance”
cookieless=”false” timeout=”20″ />
Advantages:
* Supports web farm and web garden configuration
* Session state is persisted across application domain recycles and even IIS restarts when session is maintained on different server.
Disadvantages:
* Requires serialization of objects
Choosing between client side and Server side management techniques is driven by various factors including available server resources, scalability and performance. We have to leverage both client side and server side state management options to build scalable applications.
When leveraging client side state options, ensure that little amount of insignificant information is exchanged between page requests.
Various parameters should be evaluated when leveraging server side state options including size of application, reliability and robustness. Smaller the application, In process is the better choice. We should account in the overheads involved in serializing and deserializing objects when using State Server and Database based session state. Application state should be used religiously.
Ref : http://dhondiyals.wordpress.com/2010/03/19/state-managements-in-net/
Subscribe to:
Posts (Atom)