Showing posts with label Microsoft Access. Show all posts
Showing posts with label Microsoft Access. Show all posts

Thursday, 25 December 2014

SharePoint 2010 Custom List: Row Level Secuity

Business Case: Sharing a comprehensive list data among different stakeholders where every stakeholder can view\read only those row as per her Role\Unit


Resolution: 
(1) Export the existing list data into SharePoint custom list including the column: Unit.
(2) Add a new empty temporary column: trigger update.
(3) Build a row level security based on the field row for each row.

Let's elaborate on step number (3), where we are going to create a new workflow assocuated with this list and to run on every Create\Update item.


a) Create Permissions groups within SharePoint. 
Each Group will be equivalent to each Unit, same name.

b) Create the workflow:
1) Open the SharePoint site with Microsoft SharePoint Designer.
2) Navigation --> Site Objects --> Lists and Libraries --> Open that specific custom list with the data.
3) From the upper toolbar: list Workflow to create a list workflow.


4) Set Start options for the workflow: Item Created\Changed.


5) Edit Workflow.


6) Click Impersonation Step on the top toolbar to add a new Impersonation step, then remove the existing Step 1.

7) Click on the orange underline to activate the toolbar Action button.

8) Add a new action: Replace List Item Permissions.


9) Similarly, beneath it, add a new action: Add List Item Permissions.


10) Since we are interested to set the security on the item level, this workflow will do the function on the current item, replace this list in both steps with Current Item

11) To guarantee that the owners still have the permissions to access this list item, grant site owners all the permissions in the first replace step.



12) Now, to the core idea which is matching the field Unit with the equivalent group.
The result is that each row will have Read Access granted to the group members for the equivalent members of the group with the same name.


13) Save and Publish.

14) It is recommended to break the inheritance for this custom list so that the list items would be immune to any permissions changes at higher levels.

15) One time step: activate the workflow on all the items through through filling in the temporary column  created earlier: Trigger Update. A simple way to do it is through filling it within the Spreadsheet view for the list. Delete the temporary column:Trigger Update from the list.
















Tuesday, 24 December 2013

Microsoft Access: Error copying data to Sharepoint

Error Reproduction:
1) Open Excel file in Access
2) EXTERNAL DATA --> More --> SharePoint List


Error message:
There was an error copying data to a SharePoint list.Duplicate output destination 'Title'.



Workaround:
In my case that was a column with the title "title", just by removing it from the source Excel sheet, the export completed successfully, and even with the column title in the destination!

Another recommendation I read somewhere was to rename the Excel sheet filename to eliminate any special characters, which wasn't my issue.

Tuesday, 28 February 2012

Using SSMS with MS Access

The following is the steps to run a SQL statement against MS Access database using SSMS (SQL Server Management Studio)

1) Enable "Ad Hoc Distributed Queries


EXEC sp_configure 'show advanced options', 1
GO
RECONFIGURE
GO
EXEC sp_configure 'Ad Hoc Distributed Queries', 1
GO
RECONFIGURE


2)Use" OpenDataSource"


Select   * 
FROM OpenDataSource('Microsoft.Jet.OLEDB.4.0', 'Data Source=\\ServerName\FolderName\DBFileName.mdb')...[TableName] AS T


Unfortunately, finally I got:  :'(


OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)" returned message "Cannot open database ''.  It may not be a database that your application recognizes, or the file may be corrupt.".
Msg 7303, Level 16, State 1, Line 2
Cannot initialize the data source object of OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)".


http://connect.microsoft.com/SQLServer/feedback/details/284113/import-excel-data-with-openrowset-on-production-server


Looks like the file should not be open by someone else!!!

Sunday, 5 February 2012

Detecting Access version which created the file

Although it might be so trivial as the title implies; however, it took me really hours deceived that this can be achieved through a straight forward method like looking up the file properties dialog or finding it somewhere on opening this file in the access application.

The outcome for this research was the following windows VB Script for opening an Access file and displaying the original Access version utilized based on a property called FileFormat.


AccessFieVersionDetector.vbs
--------------------------------

' Initialization
ScriptName = "** Access File Version Detector **"
MsgBox "Please select the Access file...", 0, ScriptName

' Input Access file path
Set ObjFSO = CreateObject("UserAccounts.CommonDialog")
ObjFSO.InitialDir = "c:\"
InitFSO = ObjFSO.ShowOpen
If InitFSO = False Then
    MsgBox "Script Error: Please select a file!", 0, ScriptName
    Wscript.Quit
Else
    MsgBox "You selected the file: " & ObjFSO.FileName, 0, ScriptName
End If

' Open Access file specified
Set objAccess = CreateObject("Access.Application")
objAccess.OpenCurrentDatabase(ObjFSO.FileName)
CurrentFileFormat = objAccess.CurrentProject.FileFormat

' Display the equivalent Access version utilized to create this file
Select Case CurrentFileFormat
    Case 2
MsgBox "It is Microsoft Access 2", 0, ScriptName
    Case 7
MsgBox "It is Microsoft Access 95", 0, ScriptName
    Case 8
MsgBox "It is Microsoft Access 97" , 0, ScriptName
    Case 9
MsgBox "It is Microsoft Access 2000", 0, ScriptName
    Case 10
MsgBox "It is Microsoft Access 2003", 0, ScriptName
    Case 11
MsgBox "It is Microsoft Access 2007", 0, ScriptName
    Case 12
MsgBox "It is Microsoft Access 2010", 0, ScriptName
    Case 13
MsgBox "Not yet! ;)" + Chr(13) & Chr(10) + "It is Unknown file type!", 0, ScriptName
Case Else
MsgBox "It is unknown file type!"
End Select