Showing posts with label SharePoint 2010. Show all posts
Showing posts with label SharePoint 2010. Show all posts

Tuesday, May 6, 2014

Discovering or Reports on the items permissions for SharePoint Library or List PowerShell script

 

Clear-Host

if((Get-PSSnapin | where{$_.Name -eq "Microsoft.SharePoint.PowerShell"}) -eq $null)
{
Add-PSSnapin Microsoft.SharePoint.PowerShell;
Write-Host "Snap In Added";
}
$SiteUrl = "<site url>/sites/ags/spg/pit/pitsite";

Function GetFiles($folder)
{
# Use recursion to loop through all subfolders.
foreach ($spFolder in $folder.SubFolders)
{

if($spFolder.Name -ne 'Forms')
{
if($spFolder.Item.HasUniqueRoleAssignments)
{
$roleAssignments = $spFolder.Item.RoleAssignments;
if ($roleAssignments.Count -gt 0) {
foreach ($role in $roleAssignments){
$eachRole = $role.Member.ToString();
$allRoles += $eachRole + ";";
}
$url=$SiteUrl+"/"+$spFolder.Url
#$link = "<a href=" + $url + ">" +$url + "</a>";
$OutInfo = $spFolder.Name + "," + $url + "," + "No" + "," + $allRoles;
Add-Content -Value $OutInfo -Path $OutFile

}
}
else
{
$url=$SiteUrl+"/"+$spFolder.Url
$OutInfo = $spFolder.Name + "," + $url + "," + "Yes" + "," + "";
Add-Content -Value $OutInfo -Path $OutFile
}
}
GetFiles($spFolder)
}
}
 
$OutFile = "D:\test\Permissions.csv"
$Header = "Folder Name,Folder URL,IsInherited,Permissions"
Del $OutFile

Add-Content -Value $Header -Path $OutFile



$web = Get-SPWeb -Identity "<site url>sites/ags/spg/pit/pitsite"

$list = $web.GetList("<siteurl>/sites/ags/spg/pit/pitsite/Shared Documents")

GetFiles($list.RootFolder)

Thursday, May 16, 2013

retaining the values of lookup column after deleting the item from the look up list in SharePoint 2010

Hi Friends,

there is interesting requirement came when people started testing on some of the OOTB application, we usually develop rapid OOTB application in SharePoint 2010. One of our tester is started testing the application, he was deleting the items from the look up column and customer wanted to retain those values it the list so that they can identify what was the value previously

this can be achieved in two way

one InfoPath

1) if you are designing the form in in InfoPath, instead of look up column, create a single line text,

2) make that as drop down

3) then bring the data from the other list and on the form load bind the data.

4) so item stored the date in a single value but user can select the data from the looked up list

through SPD

1) removed the form field from where you are looking the data from the newform.aspx

2) create SPDROPDOWN control rename the IDs and all the data as per the FORM FIELDS

3) create a connection for the look up table ( you can filter also in connection like active lookup values)

4) add this connection data to SPDROPDOWN

5) save the file. it works as expected

 

Sorry I am not putting any snapshot. if anybody wants i can put those things.

thank you. happy coding OOTB   

Sunday, May 13, 2012

Message: 'length' is null or not an object

Webpage error details
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; InfoPath.3)
Timestamp: Fri, 11 May 2012 06:35:49 UTC
Message: 'length' is null or not an object
Line: 5
Char: 18997
Code: 0
URI: http://server URL/ScriptResource.axd?d=VVc9OziZh0avVAuUDckcZctyzx1FmuIlfTSxpb_QII6eINPFIyFRp05lldCgXiHUGODRhOI7dRH8sB7WoygWB-bvRxVUiAA_CcM0h88Tga5wiu6mXazcz_yOLM3apxrWorI50qlMBWvRPH_z3BQxo-LqLPw1&t=fffffffff9d85fa6
While using the Ajax Toolkit in SharePoint 2010 projects, we observed very strange behaviour of Ajax controls which works in DEV totally, not working in staging in few client machines and few not. very random behaviour. this is because of compression of few script files such as ScriptResource.axd which consumes web service to run script for the Ajax controls to run.
all the error which generates from these ScriptResource.axd can be handled with a simple web config change in all the server of the SharePoint 2010.
I will list few script error that usually come across in SharePoint projects.
If you Google with the error you wont get the solution so easily because the error related to not downloading the script file properly.
Solution:
add this in web config inside  <system.web.extensions>
<system.web.extensions>
<scripting>
  <scriptResourceHandler enableCompression="false" enableCaching="true"/>
</scripting>
</system.web.extensions>
List of common errors from ajax tool kit in SharePoint 2010 environment
Webpage error details on the ie8 laptop.
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 3.0.04506.30; MS-RTC LM 8; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; InfoPath.3)
Timestamp: Mon, 15 Mar 2010 15:52:33 UTC

Message: Invalid character
Line: 1
Char: 1
Code: 0
URI: http://tstsps01/ScriptResource.axd?d=3gtDevuF5hwGxI3DULiHKe4PLpjPC2NBqO_Aln8mJuME3vdMXP1RflDREQe-ARzl4053j1XJPuK_tKVreY7-JEJHhiZGtQfbk53NzX2FfOU1&t=57268015

Message: Invalid character
Line: 1
Char: 1
Code: 0
URI: http://tstsps01/ScriptResource.axd?d=3gtDevuF5hwGxI3DULiHKe4PLpjPC2NBqO_Aln8mJuME3vdMXP1RflDREQe-ARzlKTEXQo2eogcWU5q9nETxLMVv7VkxkeZKcJBd3mhGGIQ1&t=57268015

Message: 'Sys' is undefined
Line: 213
Char: 1
Code: 0
URI: http://tstsps01/Lists/Tasks/AllItems.aspx

Message: 'Sys' is undefined
Line: 1260
Char: 1
Code: 0
URI: http://tstsps01/Lists/Tasks/AllItems.aspx

Message: 'Type' is undefined
Line: 3
Char: 1
Code: 0
URI: http://tstsps01/_layouts/navresizer.js?rev=ulprP4hnQ3FxULueDoY8Vw%3D%3D

Message: 'Type' is undefined
Line: 2
Char: 1
Code: 0
URI: http://tstsps01/_layouts/sp.core.js?rev=hp5jN4e%2BPTRw7LrRxloaGg%3D%3D

Message: 'Type' is undefined
Line: 1
Char: 1
Code: 0
URI: http://tstsps01/_layouts/ScriptResx.ashx?culture=en%2Dus&name=SP%2ERes&rev=CKSAv76LENnzrJqc86tP2g%3D%3D

Message: Object doesn't support this property or method
Line: 2
Char: 132
Code: 0