Archive for June, 2012
This workbook cannot be opened because it is not stored in an Excel Services Application trusted location – SharePoint 2010
Posted by Rajanihanth in Excel Services, SharePoint 2010 on June 28, 2012
One of my colleagues sent me an email saying that he is getting this error (see below) whenever he tried to open an excel workbook. I just clicked the same file in the same location and I am able to open it. 🙂
But when I click on the excel file drop down –> View in Browser then I also got the same error.
The text format of the error is:
This workbook cannot be opened because it is not stored in an Excel Services Application trusted location. To create an Excel Services Application trusted location, contact your system administrator.
According to the error message, obviously we need to add the document library path to Trusted File Locations in the Central Administration. So we will see the steps here.
Step 1: Go to Central Administration –> Manage service applications under Application Management
Step 2: Then click on the Excel Services Application
Step 3: Click on the Trusted File Locations
Step 4: Just click Add Trusted File Location under Excel Services Application
Step 5: Add the document library url (OR file location) on the Address box and check the Children trusted check box –> Click ok
Please note: Don’t use like http://server:1010/documentlibrary1/forms/default.aspx instead of http://server:1010/documentlibrary1
If you use SSL (Secure Sockets Layer)/HTTPS connections, just add https:// on the address.
If you want to read more about this just click here. The similar problem in SharePoint 2007 also, you can find the solution in my previous post.
After completing this configuration, you might get the “The workbook cannot be opened” error, if you want to get the solution just read here. 🙂
References:
1. http://sharepointknowledgebase.blogspot.ca/2011/12/excel-services-sharepoint-2010-trusted.html
DDL, DML, DCL and TCL Commands/Statements
Posted by Rajanihanth in SQL Server, Tech Tips-SQL on June 27, 2012
Everybody knows about these statements but I just wanted to post this for quick references and also there is a new DML statement (MERGE) available in SQL Server 2008.
SQL commands are instructions which are normally used to communicate with the database to perform specific task and various other functions. Depending on the functionalities we can divide into 4 groups. They are DDL, DML, DCL and TCL.
DDL (Data Definition Language): is a vocabulary used to define data structures in SQL Server. Use these statements to create, alter, drop and truncate data structures in an instance of SQL Server. (MSDN Definition, you can read more here)
- CREATE : creates an object (a table, for example) in the database.
- ALTER : database modifies the structure of an existing object in various ways (Eg: adding a column to an existing table)
- DROP : deletes an object in the database, usually irretrievably.
- TRUNCATE : remove all records from a table, including all spaces allocated for the records are removed
DML (Data Manipulation Language): is a vocabulary used to retrieve and work with data in SQL Server. Use these statements to add, modify, query or remove data from a SQL Server database. (MSDN Definition, you can read more here)
- SELECT : retrieves data from one or more tables, or expressions
- INSERT : adds rows (formally tuples) to an existing table
- UPDATE : modifies a set of existing table rows
- DELETE : removes existing rows from a table, the space for the records remain
- MERGE : insert, update or delete operations on a target table. Normally called UPSERT operation
DCL (Data Control Language): is a vocabulary used to provide security such as roles and permissions in SQL Server. Use these statements to grant and revoke permissions to SQL Server database.
- GRANT : gives user’s access privileges to database
- REVOKE : withdraw access privileges given with the GRANT command
TCL (Transaction Control Language): is a vocabulary used to manage the changes made by DML statements in SQL Server. Use these statements to commit or rollback the transaction in a SQL Server database. (Read more here)
- COMMIT : causes all data changes in a transaction to be made permanent
- ROLLBACK : causes all data changes since the last COMMIT or ROLLBACK to be discarded, leaving the state of the data as it was prior to those changes.
- SAVE TRANSACTION : save the state of the database at the current point in transaction
Please Note: I didn’t get a chance to work with ‘Save Transaction’, if you want to read more about this please click here
References:
1. http://culturalview.com/books/sql.pdf
2. http://www.orafaq.com/faq/what_are_the_difference_between_ddl_dml_and_dcl_commands
Constructors and Destructors (C#)
Posted by Rajanihanth in .Net, Tech Tips-.Net on June 26, 2012
This is for my quick references and I have taken most of the information from MSDN and other web sites. BTW I have written and tested the source!
Constructors
– Constructors are methods that are executed when an object of a class is created.
– They have the same name as the class.
– A class may have multiple constructors that take different arguments.
– Constructors enable the programmer to set default values.
– Like class, structs also can have constructors.
There are 3 kind of constructors in .Net (as far as I know), they are
- Instance Constructors -Used to create and initialize instances of the class
- Private Constructors – A special type of instance constructor that is not accessible outside the class (cannot be instantiated)
- Static Constructors – Automatically initialize the class before the first instance is created or any static members are referenced
public class A //Class Name A { public int i; public A() // Constructor of A { i=1; } }
class Program { static void Main(string[] args) { A a = new A(); //Initiated with new Operator Console.WriteLine("The initialized value is: {0}", a.i); System.Console.ReadLine(); //This line is to stop the result window } }
Destructors
– are used to destruct instances of classes.
– cannot be defined in structs. They are only used with classes.
– A class can only have one destructor.
– cannot be inherited or overloaded.
– cannot be called. They are invoked automatically
– does not take modifiers or have parameters.
class A { public A() { Console.WriteLine("Constructor"); } ~A() { Console.WriteLine("Destructor"); } }
class Program { static void Main(string[] args) { A a = new A(); //Initiated with new Operator System.Console.ReadLine(); //This line is to stop the result window } }
Access is denied: ‘xxx.dll’ – Manually add an assembly (.dll) to the GAC on Windows Server 2008 R2
Posted by Rajanihanth in .Net, GAC, SharePoint 2007, SharePoint 2010, Webpart on June 26, 2012
I supposed to post this issue few months ago, but I don’t really know why this has been in my draft folder till this date! When we were migrating our servers to new environment, we deployed some custom web parts manually. While deploying the web part (Drag and drop the assembly (web part .dll) into Global Assembly Cache (GAC) folder) I have got the following wired error message! 😦
GAC normally located in C:\Windows\assembly directory, and ‘WebPartStepBiStep.dll‘ is my web part assembly.
After spending some time on the web, I have got the solution here. Actually the ‘User Account Control: run all administrators in Admin Approval Mode’ was Enabled on the Local Security Policy. Which means the local administrators group required Admin Approval Mode (AAM) to perform these kind of operations. Here is the definition for Admin Approval Mode (AAM) from MicroSoft site.
Admin Approval Mode: AAM is a User Account Control (UAC) configuration in which a split user access token is created for an administrator. When an administrator logs on to a Windows Server 2008, the administrator is assigned two separate access tokens. Without AAM, an administrator account receives only one access token, which grants that administrator access to all Windows resources.
To access the Local Security Policy, either we can goto the Administrative Tools –> Local Security Policy OR we can run the ‘secpol.msc’ on the command prompt.
Start –> Administrative Tools –> Local Security Policy
Click Start –> Cmd –> type ‘secpol.msc’ then enter
You will be getting the Local Security Policy window like below and the highlighted is the AAM.
So the solution for our problem is Disabled the User Account Control. To do this double click on the highlighted policy on the Local Security Policy above and then you will be getting this window.
Click Disabled and OK.
After disabling this you will be able to drag and drop the .dll to the GAC.
Please Note: 1. Rebooted required for changes to the local security policy on the server.
2. Disabling this can make security problems in your environment, so after completing task, you should be enabled back the UAC.
That’s all guys, Happy drag and dropping..!
Thanks. R/.
References:
Content Editor Web Part (CEWP) & JavaScript duplicating entries in SharePoint 2010
Posted by Rajanihanth in SharePoint 2007, SharePoint 2010, Webpart on June 19, 2012
Recently we have migrated our SharePoint 2007 application to SharePoint 2010 and we also had manually configured few web parts in the new environment. Most of the web parts were working perfectly like sharepoint 2007 but one content editor web part which shows the weather forecast had some wired repeating behavior! 😦
Here is the weather forecast web part in the 2007 which has JavaScript to update the weather from their web site.
The JavaScript code in the Source editor:
I have created the CEWP in 2010 and paste the source code in to the editor.
and Publish the page, It is working fine no? but not really..!
Whenever I edit the page, the web part is duplicating the weather widget like this!
After spending few minutes I have found the solution in this post, actually SharePoint 2010 does not support the JavaScript directly into the source editor. So we cannot copy and paste the JavaScript to the CEWP editor instead, we have to create the scripts as a txt file (paste into a Notepad and save), upload into the SharePoint and then pointing that file as the source of CEWP.
Step 1: Open a Notepad and paste the source code
Step 2: Upload the txt file into SharePoint
Step 3: Get the url path of the txt file and paste it on the content link property of the content editor pane on the right side and click ok.
That’s all. No duplication probs any more. Happy Migrating..!
Thanks. R./
References:
1. http://sharepointadam.com/2010/08/31/insert-javascript-into-a-content-editor-web-part-cewp/
Unexpected Error has occurred. Error is ‘SetParent failed for Database ‘AR633564737049916886′.’
Posted by Rajanihanth in BDC, SharePoint 2007 on June 14, 2012
When I was installing the Application Definition Designer, I have got the following wired error message! 😦
The text format of this error message is:
Unexpected Error has occurred. Error is 'SetParent failed for Database 'AR633564737049916886'.' --> SetParent failed for Database '<em>AR633564737049916886'.' --> Failed to connect to server. \BDC. --> An error has occurred while establishing a connection to the server. When connecting to SQL Server..
This is not even a brief message to understand no? After spending few minutes, I have found the possible causes for this error.
1. Not enough permissions to configure BDC (Business Data Catalog) instance
2. There is no BDC instance on our SQL Server, this means the installation expects the BDC instance to continue.
In my case, I have adequate permissions for BDC, so the problem is 2nd one. If we run the BDCStudioSetup.msi file directly, Instead of running the setup.exe on the “BDC Definition Editor” directory then we get this error! 😦
You can see the complete installation and configuration of Application Definition Designer here.
Happy configuring..! Thanks. R./
References:
1. http://www.techyv.com/questions/setparent-failed-database-error-while-installing-data-catalog
2. http://www.microsoft.com/en-us/download/details.aspx?id=79
Installing and configuring the “Application Definition Designer” tool – BDC
Posted by Rajanihanth in BDC, SharePoint 2007 on June 14, 2012
Everyone knows about the usage of Application Definition Designer, this is a Microsoft tool that comes with the SharePoint Server SDK. You can see the overview and the system requirements here. While installing this tool I have faced few problems, so I just wanted to keep the steps in my bolg.
Step 1: Download the tool and double click the “OfficeServerSDK.exe”, You will be getting this screen.
Step 2: Click Next 😦
Step 3: The Office SharePoint Server 2007 SDK has been successfully installed. Great!
Step 4: Navigate to SDK installation path\Tools\BDC Definition Editor\. The default installation path for the MOSS SDK is <%Program Files%>\2007 Office System Developer Resources\. For me this is the path..
C:\Program Files \2007 Office System Developer Resources\Tools\BDC Definition Editor
Step 5: In this directory, double click the setup.exe
Please Note: If you double click the BDCStudioSetup.msi file directly, Instead of clicking setup.exe then you will get this error. This happened to me when I installed! 🙂
Step 6: Click Accept and continue, this will configure the SQL client.
Step 7: Click Next and close! 🙂
Step 8: That’s all, you can run the “ApplicationDefinitionDesigner.exe” in the “All Programs”
Step 9: We are ready to create the ADF (Application Definition File) to configure the BDC (Business Data Catalog) now.
Thanks. R./
References:
1. http://www.microsoft.com/en-us/download/details.aspx?id=79
2. http://nareshbojja.wordpress.com/2008/09/08/setparent-failed-for-database/
There are no Business Data Types loaded in the Catalog – Business Data Type Picker
Posted by Rajanihanth in BDC, SharePoint 2007, Webpart on June 7, 2012
I was working on BDC (Business Data Catalog), to display the user profile data from SQL Server in SharePoint 2007. I was using “Application Definition Designer” (A Microsoft tool that comes with the SharePoint Server SDK, you can see the installation and configuration here) to generate the ADF (Application Definition File). I tried to access the Business Data Types on the SharePoint page and then I have got the following wired error message. 🙂
BDC is not a really new stuff, so I tried to find the solution on the web but I didn’t get any direct solution immediately. Most of them are suggested to check the permission but I have adequate permission for BDC. Finally I have got the solution form this thread. Actually this is a bug in the Application Definition Designer and I don’t really know why it’s still there!
There might be two reasons to getting this error.
1. Not having enough permission to access the BDC
2. The “Finder” method is not generating properly in the “MethodInstanceType” property.
In my case I had adequate permisioion for the BDC, so the “Finder” method was my problem.
You can see the “MethodInstanceType” property has “IdEnumerator” method instead of the “Finder”. So just click the drop down list and select the Finder method.
Then just export the ADF again, the Business Data Type Picker is showing the entries now huh? 🙂
References: