Friday, 28 December 2012

SharePoint - Cannot peform this operation. The file is no longer checked our or has been deleted


Recently I faced a problem, that in SharePoint Designer (2010), one of my file I checked out and then I checked Inn. Again when I opened my SharePoint site in Designer, it was showing the same file as checked inn. So I thought I might have forgot to check Inn. I again tried to check Inn, but it promt me an error message : 
               " Cannot peform this operation. The file is no longer checked our or has been deleted  "


It is because of the cache being mantained with respect to user websites and application data.
What you have to do is, go to following locations :
  • %APPDATA%\Microsoft\Web Server Extensions\Cache
  • %USERPROFILE%\AppData\Local\Microsoft\WebsiteCache
And clear all the content inside both folders. and try again, you are done!!

Hope this help!!

Saturday, 22 December 2012

The Report Server "http://localhost//ReportServer" is invalid


Recently I faced a problem while installing with ReportingInstaller for Microsfot Commerece Server 2009 R2,  parameters like data warehouse server and Report Server url were correct but when I clicked "Test Connection" I got error message that :

"The Reporting Server "http://localhost/ReportServer" is invalid."


I googled for it, but didn't find any solution. What I did , I tested the url I was trying to hit in browser, then it returned me error that :

 "The report server cannot open a connection to the report server database. A connection to the database is required for all requests and processing"

Then I googled for it and found that we have to add user in the ReportServer configuration, and by following command you can add user :

rsconfig -c -s < SQLSERVERNAME > -d reportserver -a Windows -u < MYDOMAIN\MYACCOUNT > -p < PASSWORD >orrsconfig -c -m < REMOTECOMPUTERNAME > -s < SQLSERVERNAME > -d reportserver -a SQL -u SA -p < SAPASSWORD >
It worked for me nicely!!

Hope it help someone else..!! :-)

Friday, 7 December 2012

Javascript or Css disappears in Content Editor Webpart - CEWP


Recenlty I faced a problem that I was writing some html along with javascript tag with some code in the CONTENT EDITOR WEBPART (CEWP). As soon as I save the page, all the tags of javascript disppeared or removed from CEWP. I googled, but did not find any solution.


What I did, encapsulated the script and html within "CDATA" section, actually sharepoint 2010, it was removing all such script tags from the CEWP becasuse of secrutiy purpose, it removes all the script which could threaten or inject. Thus CDATA solved my problem.

Updated (Feb 18 2013) :
On my friend's request FAZ, am including an example to explain it littile bit more on this topic.

Sometimes you edit a page in sharepoint designer, and add javascript snippet in the page, on saving the page it prompt you a message that "unsafe code will removed...", and when the page is saved you will notice that the javascript snippet you just added is removed.
For Example:
1. Edit a page and add some javascript code snippet in the Content Editor Webpart and save.
 (Content Editor webpart is inserted using "Insert" tab in the SharePoint Designer, and then "Webpart" menu, and then select "Content Editor")
2. When you will save , it will prompt a message just shown in the figure below:

3. When you will click "Yes", you will notice that the javascript snipped you just added have been removed from the page.
So for that we have to keep our javsacirpt / CSS snippet in CDATA wrapping as shown below:

<script type="text/javascript"><![CDATA[
function Test()
]] </script>

Then it will not remove your snipped from the page.

Hope this help!!

Thursday, 6 December 2012

Captcha not working when hosted in IIS


Recently I faced a problem that captcha was working when I browse my page which contains Captcha , was working fine, but when I hosted site in IIS , captcha image was not appearing instead it was showing just cross mark when I browse page in IE.


Finally I found its solution. If you check the path of captcha image by right click, take properties of the image which is appearing as red cross mark, it will show you what its actually trying to hit or show, in my case it was an aspx patch with name CaptchaImage.aspx?id={xxxxx}, something like this.

So what I did, in IIS, 
1. selected my application, and
2. then chose "Handler Mappings", 
3. then clicked "Add Managed Handler" under "Action",

4. Request Path : Type the target url path of your captcha, as in my case mentioned above as page CaptchaImage.aspx,
in some cases it could be with different extension like CaptchaImage.axd, to confirm this, check your web.config , you will find this path in the tag you added for captch to work.
5. Type :  choose your dll or assembly from dropdown, if it is  not appearing , then you will have to add that assembly or dll as reference in your application or project from VS.
6. Name:  Type  any name for the hanlder, like CaptchaHandlerMapping . and click OK.

Now again browse page having captcha , it must work!!.
Hope this help.

Sunday, 2 December 2012

System.Security.SecurityException was unhandled by user code - InfoPath 2010


Sometimes working with InfoPath , in my case its InfoPath - 2010, come across a problem of security exception mentioned below :

System.Security.SecurityException was unhandled by user code
Request for the permission of type 'Microsoft.SharePoint.Security.SharePointPermission, Microsoft.SharePoint.Security, Version=, Culture=neutral, PublicKeyToken=xxxxxx' failed

This exception arises when we are using some code snippet to communicate with SharePoint in any way. 

Plus would like to mention that when we use any "Manage Data Connection" , and preview our InfoPath form, it usually prompt a message :


To solve this problem, you have to switch your InfoPath - 2010 form to Full Trust.
To do that, click "File" , then from menu choose "Info" and then "Form Options", and then uncheck "Automatically determine security level", by default its checked, and it will enable 3 radio buttons below this.
You have to choose "full trust", click OK. 

Now both the above mentioned warnings and exception should not occur.

Column or table name conflicting with keyword in SQL Server


Sometimes we face a problem in SQL Server that column name or table name is same as one of the keyword of SQL server, like Session, Description etc. which might cause some syntax errors.

For example:
Select  Description  From Session

It will show you highlighted Description and Session as if it is treating both as keyword. and your whole statement will become blue :-P.


To differentiate keyword and names of your column and table, you can use squar brackets around the column or table name. like

Select  [Description]  From [Session]

Hope this help someone.!!

Wednesday, 28 November 2012

Deny or avoid user on browser back button after Logout


A very common problem that we face in web application is that when user logged out, and again click the browser back button, it shows the last accessed page by the user when user was logged in, even we have included any check whether the user is signed inn or not, it is because browser shows the cached webpage.


After some net surfing , I was able to solve my issue by including these code of snippets in my code :

  Response.AppendHeader("Pragma", "no-cache");

Hope this helps.

Wednesday, 18 January 2012

Grouping By option Collapse not working - Sharepoint 2010

I recently faced a problem in External List Web part, there was an option of Group By, and its default state was "Collapsed", it was grouping the rows but it was not Collapsing the group, it remain in Expanded state, after some search I found that its a bug of SharePoint :(...

To fix this issue, we have to apply a fix :

Hope this helps.

Tuesday, 17 January 2012

External List not showing columns - Sharepoint 2010

I recently faced a problem, when I created new External List in SharePoint , but some columns does not appeared, like my primary key column, foreign key column, was totally confused.

But after some googling :) , I found that External List has some unsupported data types , which it could not map like int64 ( bigint in SQL server), object type, URL type.
And same was the issue in my case, I changed datatypes from bigint to int, and it worked for me :) :)

Thanks for your time.

Monday, 16 January 2012

Change events not working on browser - InfoPath Form

In infopath, you might face a problem that the change events for controls work on local system but when deployed to the server or run in browser, these change events might not work like change event for dropdown list, checked change event for Checkbox.

You just have to set an option in the properties of the control.
Right click on the control for which event is not working, click Control properties, probably the last option in the menu, and in the Properties windows, select "Browser forms" tab. You will find 3 options there,
  1. Never
  2. Always
  3. Only when necessary for correct rendering of the form
By default, the 3rd option is selected, you have to select the 2nd option i.e "Always".
You problem is solved :)

Thanks for you time.

Sunday, 15 January 2012

SQL Server Analysis Services (SSAS) - Analysis Service Project

Step 1: How to Start SQL Server Business Intelligence Development Studio ( BIDS)
  1.   Start > SQL Server 200X >  SQL Server Business Intelligence Development Studio (Please launch it by "Run As Administrator" else it might retrist access in deployment process. ) 
  2.  Then click File Menu > New > New Project
  3.   Select "Business Intelligence Project" in Project Types column on left
  4.   Select "Analysis Service Project" in templates column on right.
  5.   Provide Name for the project for e.g "MyAnalysisServiceProject", set location/path for the project solution. and click OK.
Step 2 : How to Add New Data Source
  1.   In solution explorer, under "MyAnalysisServiceProject" (Project) node, there will be a director "Data Sources", right click on this directory & click "New Data Source...".
  2.   Read first screen for your information, and then click Next.
  3.  Select option "Create a data source based on an existing connection or new connection"
  4.   If you are adding the data source for the first time, click "New...", it will popup window with title "Connection Manager".
  5.  Choose Provider, by default "SQL Server Native Client" is selected.
  6.  Provide Server Name where your Database resides, Provide credentials either with "Windows Authentication" or "SQL Server Authentication", choose Database which you want to use in the Analysis. and then Click Next.
  7. Choose "Use the service account" and click next.
  8. Provide name for the datasource anc click "Finish".
You will see that new datasource with the name you provided in last step wil appear under the folder Data Sources in the solution exlorer.

Step 3: How to Add New Data Source View
  1. In solution explorer, under "MyAnalysisServiceProject" (Project) node, there will be a director "Data Source View", right click on this directory & click "New Data Source View...".
  2. Read first screen for your information, and then click Next.
  3. In next screen, we will have data source which we created in step 2, click Next again.
  4. In next screen, we will have all the tables and views listed which exist in the data source we selected. We will have to select the tables which we want to use for the data analysis. Select the desired tables and click ">" , and if you want to add the related tables to those you have selected, click "Add related tables". After we have finished our selection process click Finish.
  5. BIDS will automatically display the schema of the new data source view.
Now we have Data source from which we want to fetch data and we have created a view schema structure.

Step 4 : How to structure a Cube
  1. Right-click on the Cubes folder in Solution Explorer and select New Cube.
  2. Read first screen for your information, and then click Next
  3. 3. Select the option to Use Existing Tables.
  4. Click Next.
  5. The data source view which we created in Step 3 should be selected in the drop-down list at the top.
    Place a checkmark next to the tables which you want to designate it as a measure
    group table, such as SalesOrder table having column Amount. then click Next.
  6. Remove the check mark for the fields which are not indicating that as measures we wish to summarize, and click Next.
  7. Leave all other tables selected as dimension tables, and click Next.
  8. Name the new cube MyCube and click Finish.
Step 5 : How to define dimensions

           Cube wizard has already defines the dimensions, but the wizard will not add the attributes with the dimensions, it will have only the keys, we will have to add required columns like ProductName , Country Name  by our selves.
  1.  In BIDS, double click on any one of the Dimension under Dimensions director in the Solution Explore. 
  2. Drag the listed columns from the right-hand panel (named Data Source View) and drop them in the left-hand panel (named Attributes) to include them in the dimension.
Step 6 : How to define Hierarchy
  1.  In BIDS, double-click on DimDate in the solution explorer
  2.  Create a new hierarchy by dragging the field from the left-hand pane (called Attributes) and drop it in the    middle pane (called Hierarchies.)
  3. Add a new level by dragging the next level field from the left-hand panel and drop it on the <new level> spot in the new hierarchy in the middlepanel. 
  4. Add a third level by dragging the field to the <new level> spot in the hierarchy.
  5. Right-click on the hierarchy and rename it to according to your need.
 Step 7: How to Deploy and Process Cube
             At this point, you’ve defined the structure of the new cube - but there’s still more
             work to be done. You still need to deploy this structure to an Analysis Services
             server and then process the cube to create the aggregates that make querying fast
             and easy
             To deploy and process your cube, follow these steps:
            1. In BIDS, select Project from the menu system.
            2. Choose the Deployment category of properties in the upper left-hand corner of
                the project properties dialog box.
            3. Verify that the Server property lists your server name. If not, provide it your server name.
        After checking all these, right click on project node in the solution explorer and click deploy. It will         show   deployment processes in the Deployment Progress window. If there will be no problem occured, it will give message "Deployment Completed Successfully". It might ask you for the credentials, before the deployment process starts, provide it the data source (database) credentials.
          It might raise an error like :
                "Error    9    Either the 'Server' user does not have permission to create a new object in 'Server', or the object does not exist.

Don't worry , relax : )......just save the solution....and again Launch the BIDS by right click on the icon and "Run As Administrator".

After the deployment is successful, you can browse the data cube you just generated. Right click on "MyCube" and click browse. It will open the cube browser, now you can play with it as you wish, drag the measure group items in the "Data/Detail Fields" section, and column and row fields in the respective sections labeled on the center area, as we do in Tabular reports.

So, thats all for this post. In next article I will show you "How to create reports" based on this Analysis Service Project. : ) ...
Thanks for your time.