Skip to main content

Posts

Showing posts from 2011

No AllowUnsafeUpdates ?

Alternative for AllowUnsafe updates if (null != SPContext.Current) { SPUserToken adminUser = SPContext.Current.Site.SystemAccount.UserToken; using (SPSite site = new SPSite(SPContext.Current.Site.ID, adminUser)) { using (SPWeb web = site.OpenWeb()) { SPUtility.ValidateFormDigest();  //Enter your code here to do Operation } } } SharePoint smoking................ Dharani

Error While Accessing SharePoint through Console

If you are trying to access the SharePoint site through console for the first time you may get the below error System.IO.FileNotFoundException was unhandled   Message=The Web application at http://win-872tgscbp72:2890 could not be found. Verify that you have typed the URL correctly. If the URL should be serving existing content, the system administrator may need to add a new request URL mapping to the intended application. To resolve this 1) Project Properties -- > Application tab Just check target framework is .Net Framework 3.5 2)Project Properties -- > Build tab Platform target to ANY CPU or x64 By following these 2 steps it should work fine, If your still getting the error change the Debug option as shown below and last  everything   will  work fine. SharePoint smoking.......... Dharani

Points regarding SharePoint 2010

DON'T use ID or id keyword as a query string in SharePoint, It will give error. As it is already used by SharePoint internal. Per farm only one config file will be there Identitfying Worker process      cmd     cd Windows--->system32 ----> Inetsrv     run       appcmd list wp  Ghosted means Page is NOT customized  Unghosted means Page is customized.  Approving through Object model       always check ModerationInformation == null for a item  Note: If versioning/content approval is not enabled then          ModerationInformation will be null Profile Page : Allows to display all the information for external content Checking the code running is sandbox                                AppDomain.CurrentDomain.FriendlyName.Contains("SandBox")...

SharePoint Application Life Management Phases

SharePoint Application Life Management Phases  Capacity planning  Infrastructure Creation  Configuration and Administration  User and Application Management  SharePoint Customization  SharePoint Customer Experience  SharePoint Administration or Operation Management SharePoint Smoking........ Dharani

Redirecting infopath form after Submit

 To redirect the Infopath form after submit button Just change the source value in the URL. Create a infoapth Form and publish to a library. In the Advance settings of the form library select the Option OPEN IN BROWSER Click on the add item in the form library and  Copy the URL of the INfopath form from the browser, for example http://win-872tgscbp72:2890/_layouts/FormServer.aspx?XsnLocation=http://win-872tgscbp72:2890/TestChking/Forms/template.xsn&SaveLocation=http%3A%2F%2Fwin%2D872tgscbp72% 3A2890%2FTestChking&Source= http%3A%2F%2Fwin%2D872tgscbp72%3A2890%2FTestChking%2FForms%2FAllItems%2 Easpx &DefaultItemOpen=1 Change the source attribute value of url to the page where you want to navigate. Remember to replace .,/,: with respective values  %2E  ,   2F%  , %3A  in the source attribute value. check the below link http://Server/_layouts/FormServer.aspx?XsnLocation=http://win-872tgscbp72:2890/TestChking/Forms/template.xsn...

Displaying Detailed Error in Sharepoint

Change the Web.config file of the webapplication which presents in the below location Drive:\inetpub\wwwroot\wss\VirtualDirectories\ Select the Port number of the Web Application and the Web Config and Edit as shown below 1) Callstack=true in the safeMode tag. 2) Debug=true in the Compilation tag 3)CustomError Mode=off and Last restart the IIS. SharePoint Smoking......... Dharani

Retrieving Picture URL or User Info from sharepoint webservices

First add the web reference to the userprofileservice.asmx http://serverURL/_vti_bin/userprofileservice.asmx using  System; using  System.Collections.Generic; using  System.Linq; using  System.Text; using  Microsoft.SharePoint; using  Microsoft.SharePoint.Administration; using  System.Net; using  ConsoleApplicationSharepointTesting . WebServiceMyReference;  (Name of the Web reference)      namespace  ConsoleApplicationSharepointTesting { class   Program { static   void  Main( string [] args) { PropertyData [] userDetails; UserProfileService  userprof =  new   UserProfileService (); SPSecurity .RunWithElevatedPrivileges( delegate () { userprof.PreAuthenticate =  true ; userprof.Credentials =  new   NetworkCredential ( "UserName" ,  "Password" ,  "Doamin" ); userDetails = userprof.GetUserProfileByName( "Domain\UserName" ); if  (userDetail...

Getting the User profile

Note : Got the code while search for User profile in Net. I have changed only the Red Line because the code I got, was getting the context as null. private   UserProfile  GetUserInfo( string  AccountName) { UserProfile  profile =  null ; SPServiceContext  serviceContext = SPServiceContext.GetContext(SPContext.Current.Site); UserProfileManager  profileManager =  new   UserProfileManager (serviceContext); if  (AccountName !=  string .Empty) { profile = profileManager.GetUserProfile(AccountName); } else { profile = profileManager.GetUserProfile( SPContext .Current.Web.CurrentUser.RawSid); } return  profile; } Sharepoint Smoking.......... Dharani