Hi we have a problem while accessing MySite URL for a user profile in sharepoint.
We need to get details of MySite URL of a user using sharepoint "GetUsageData" method.
whenever we access this we are getting the exception as "Unable to evaluate the expression, because code is optimized or native code is on top of call stack".
For this I achived like below.
SPSecurity.RunWithElevatedPrivileges(delegate()
{
SPSite siteCollection = new SPSite("http://..")
SPUserToken token = siteColllection.SystemAccount.UserToken;
using(SPSite site = new SPSite(mySite,token)
{
using(SPWeb web = site.OpenWeb())
{
DataTable dt = web.GetUsageData(....);
}
}
});
Wednesday, February 9, 2011
Tuesday, November 30, 2010
Web part using Excel Services
Here I will explain how to develop a webpart using excel services in 10 easy steps.
1. Check Excel service is running or stopped. For this,
Open Central Admin -> Operations -> Services on Server, then Start the Excel Calculation Service on the server if it has been stopped.
2. Create a Document Library in your MOSS Site.
Go to Site Actions -> Create -> Document Library to create a document library in your SharePoint site. This document library will be useful to publish our Excel spreadsheets.
3. Trusted File Location
To do this, open the Shared Services Administration Site then click the Trusted File Locations -> Excel Services Settings. Now, click Add Trusted File Location and add our document library as a trusted location.
4. Now creating chart using excel.
Open excel file and enter some data as shown below.
Subject Marks
Maths 40
Science 50
Hindi 43
Computers 60
From Insert menu select Chart.
Select the entire table from subject to marks (table as prepared above).
5. Now from File - > Publish - > Excel Services
6. Select "Excel Services Option" button from "Save As" dialog box.
7. From "Excel Services Option" dialog select "Items in the workbook" from dropdownlist. Click on OK button.
8. Now navigate to your site. Now Site Actions - > Edit page.
9. Add "Excel Web Access Webpart" webpart. From Web part properties set the Workbook property as Shared document library path along with excel workbook name (eg: http://blahblah.com/sites/Shared Documents/TestChart.xlsx)
10. Click on Apply and then Ok button. That is.
Easy way of doing excel services in sharepoing.
1. Check Excel service is running or stopped. For this,
Open Central Admin -> Operations -> Services on Server, then Start the Excel Calculation Service on the server if it has been stopped.
2. Create a Document Library in your MOSS Site.
Go to Site Actions -> Create -> Document Library to create a document library in your SharePoint site. This document library will be useful to publish our Excel spreadsheets.
3. Trusted File Location
To do this, open the Shared Services Administration Site then click the Trusted File Locations -> Excel Services Settings. Now, click Add Trusted File Location and add our document library as a trusted location.
4. Now creating chart using excel.
Open excel file and enter some data as shown below.
Subject Marks
Maths 40
Science 50
Hindi 43
Computers 60
From Insert menu select Chart.
Select the entire table from subject to marks (table as prepared above).
5. Now from File - > Publish - > Excel Services
6. Select "Excel Services Option" button from "Save As" dialog box.
7. From "Excel Services Option" dialog select "Items in the workbook" from dropdownlist. Click on OK button.
8. Now navigate to your site. Now Site Actions - > Edit page.
9. Add "Excel Web Access Webpart" webpart. From Web part properties set the Workbook property as Shared document library path along with excel workbook name (eg: http://blahblah.com/sites/Shared Documents/TestChart.xlsx)
10. Click on Apply and then Ok button. That is.
Easy way of doing excel services in sharepoing.
Monday, August 9, 2010
How to redirect user after an alert message ?
ClientScriptManager script = Page.ClientScript;
if (!script.IsStartupScriptRegistered(this.GetType(), "Alert"))
{
script.RegisterStartupScript(this.GetType(), "Alert",
"");
}
if (!script.IsStartupScriptRegistered(this.GetType(), "Alert"))
{
script.RegisterStartupScript(this.GetType(), "Alert",
"");
}
What is sharepoint ?
Sharepoint is a microsoft technology which includes
Collaboration : A team of people working on a project to sharepoint information, documents to accomplish the golas.
Document Management : Manage and share documents through the use of versioning, metadata, workflows, search, profiles and information management policies.
Portal : An user interface that brings information together from different applications, and other sources such as web services and web sites.
Content Management : publishing and design processes for pages on portals and other web sites.
Collaboration : A team of people working on a project to sharepoint information, documents to accomplish the golas.
Document Management : Manage and share documents through the use of versioning, metadata, workflows, search, profiles and information management policies.
Portal : An user interface that brings information together from different applications, and other sources such as web services and web sites.
Content Management : publishing and design processes for pages on portals and other web sites.
Thursday, July 22, 2010
What is the Use of RunWithElevatedPrivileges method in sharepoint ?
When you want to perform actions that require more privileges than the current user has, an easier and more elegant solution is available. This solution is called credential-less-impersonation. This method enables the code to execute as system code under the identity of SHAREPOINT\system. We can use this method when you want to access resources that are not controlled by the SharePoint API. This is new in SharePoint 2007. SP uses IIS, and IIS use application pool identities as the context in which worker processes are run. If you call this method, you will end the current user impersonation. You will revert from a current user context to the original identity, which is the application pool identity.
Saturday, April 24, 2010
How to get a value of people picker editor control
If the values are not saving in the sharepoint list with the values entered using PeopleEditor control, or if an exception is throwing like “value or property may be read only or value does not fall ….. “ we can achieve this like following.
1. take any string array
2. using a property CommaSeparatedAccounts split this people editor control and assign to string array.
3. from that string array using foreach loop get the string.
4. pass this string as argument to EnsureUser method for web object and assign it to SPUser class object.
5. From this SPUser class object get the propeties.
1. take any string array
2. using a property CommaSeparatedAccounts split this people editor control and assign to string array.
3. from that string array using foreach loop get the string.
4. pass this string as argument to EnsureUser method for web object and assign it to SPUser class object.
5. From this SPUser class object get the propeties.
Subscribe to:
Posts (Atom)