Showing posts with label List. Show all posts
Showing posts with label List. Show all posts

Wednesday, October 28, 2015

Calculated Columns in SharePoint List/Library

SharePoint Calculated Columns are powerful tools when creating out-of-the-box solutions.With these columns, we can manipulate other columns in the list item.
Below is basic example to update list item based on other column.Lets get started

Scenario: 


Lets Create a document library named "Shared Document" ,Business Owner have assigned to review document in Library.We will create 3 additional columns in library(one-Date Time Column and two-Calculated column).

           Column  Name       Data Type

          ------------                          -------------
          Yearly review Date Time

          Review Complete                 Calculated Column


          Review Not Complete           Calculated Column



 If Documents "Yearly review" is done then "Review Complete" should be filled with "Yes" and "Review Not Complete" should be empty


 If Documents "Yearly review" is not done then "Review Not Complete" should be filled        with "Yes" and "Review Complete" should be empty.

Follow below steps to create and add formula to library/list
    


Step 1 : Create Document Library 


Step 2 : Create Date Data Type Column named "Yearly Review" 


Step 3 : Create Calculated Column "Review Complete" with below formula

         
            Formula:  =IF(ISBLANK([Yearly Review]),"","YES")

Step 4 : Create Calculated Column "Review Not Complete" with below formula

         
             Formula:  =IF(ISBLANK([Yearly Review]),"YES","")

Step 5 : Add a document and observe the "Review Complete"  and "Review Not Complete" Columns.Below is sample screenshot for above scenario.



Thanks for Reading :)               

        


Tuesday, July 14, 2015

SharePoint Excel File Upload : System.Data.OleDb.OleDbException: Unspecified error at System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection)

Hello,

When your writing SharePoint Custom solutions for file upload or importing excel file data into SharePoint list.If you get the below error.

"System.Data.OleDb.OleDbException: Unspecified error
   at System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection)
   at System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
   at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup)
   at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
   at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
   at System.Data.OleDb.OleDbConnection.Open()"

Solution:

Go to Web.Config file of your SharePoint Web Application application.The location of web.Config File is looks like this .C:\inetpub\wwwroot\wss\VirtualDirectories\80\web.config. My Web application port number is 80 so I am navigating to above Folder. Check you Web Application port number and navigate to Web.Config file folder.

Then Open Web.Config File and Find The below Tags as shown below.By default Impersonate will be set to true so you neeed to change it to false as shown in below screen shot:


More about Impersonation:

Impersonation, a feature that was added in Windows SharePoint Services 3.0, enables you to perform actions on behalf of another user. Impersonation is useful in scenarios such as timer operations that need to update something asynchronously on behalf of a user long after the user has stopped using the Web site (that is, when their workflow is completed).

Thanks for Reading!
Hope Your Issue Resolved!

Regards,
Kiny :)
  




Friday, July 10, 2015

SharePoint File Upload : The Microsoft Access database engine cannot open or write to the file ''. It is already opened exclusively by another user, or you need permission to view and write its data.

Hello,

I have faced same Issue when uploading excel file into SharePoint list:

Problem: 

Before resolving this issue,I was directly browsing the excel file from local system.When i click on upload button, I keep on getting Error "The Microsoft Access database engine cannot open or write to the file ''.  It is already opened exclusively by another user, or you need permission to view and write its data "

I was reading excel file using file upload control as shown below:

         if (!uploadfile.HasFile)
            {
                ltrlMsg.Text = "Please select a valid Excel File";
                return;
            }
            try
            {

                 //reading file from file upload control.

                 string fileName = uploadfile.PostedFile.FileName;

                //Some code goes here
            }
             catch (Exception Ex1)
               {
                            ltrlMsg.Text = Ex1.Message;

                 }

For Reference:


Solution: 

Then am storing excel file in root directory then reading file path from root directory using file upload control as as shown below:

Create New Folder in Root directory of SharePoint Web application as shown in below screen shot.
Example: I have created a folder named "GnIExcelFiles" in root path.

Root Path: C:\inetpub\wwwroot\wss\VirtualDirectories\41417

Here 41417 is port no of my Share Point web application in , check which is the port number of your web application and create new folder as described.


Then Change the code  as shown below:


string uploadexcelfile = Path.GetFileName(uploadfile.PostedFile.FileName); uploadfile.PostedFile.SaveAs(Server.MapPath("~/GnIExcelFiles/") + uploadexcelfile);
string fileName = Server.MapPath("~/GnIExcelFiles/") + uploadexcelfile;

For Reference:



I resolved my issue using above small piece of Code :)
Give A try , It will work

Thanks for Reading !

Kiny!