Wednesday, January 30, 2013
Add FBA users to the SharePoint groups reading from .CSV file
This summary is not available. Please
click here to view the post.
Friday, January 25, 2013
Error Handling and Logging in Powershell
When
you run this script it will create a .csv file where you are running your
script.
$URL = "siteurl"
$site = New-Object Microsoft.SharePoint.SPSite($URL)
$web = $site.openweb("")
#logging
$timestamp = get-date -format "yyyyMMdd_hhmmtt"
$filenameStart = "Log2CSVFile"
$logfile = ("{0}{1}.csv" -f $filenamestart, $timestamp)
$header = "Head1,Head2"
$header | out-file -FilePath $logfile
try
{
$list=$web.Lists["User
Information List"]
$listname = $list.title
$msg = ("{0},{1}" -f "List:", "$listname")
$msg | out-file -FilePath $logfile -append
Write-Host $list.title
}
Catch
{
$msg = ( "{0},{1}" -f "Error
occurred while reading list..:", $_)
$msg | out-file -FilePath $logfile -append
}
$i++
$web.Dispose()
$site.Dispose()
Tuesday, January 8, 2013
SharePoint:DateTimeControl readonly textbox + SharePoint 2010
my date control id is "dtSummaryDate" Please change the name with your date control id.
<asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server">
</asp:Content>
<SharePoint:DateTimeControl Enabled="false" runat="server" ID="dtSummaryDate
" DateOnly="true" />
<asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server">
<script language="javascript" type="text/javascript">
_spBodyOnLoadFunctionNames.push("ReadOnlyTexbox");
function ReadOnlyTexbox()
{
var x = document.getElementsByTagName("INPUT");
alert(x.length);
for (var i = 0; i
< x.length; i++) {
if (x(i).id.indexOf("dtSummaryDate") > 0) {
// alert(x(i));
//x(i).disabled = 'disabled';
x(i).setAttribute('readonly', 'readonly');
}
}
}
</script>
Labels:
date,
SharePoint 2010,
SharePoint DateTimeControl
Thursday, December 20, 2012
An exception occurred when trying to issue security token: The server was unable to process the request due to an internal error. For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework 3.0 SDK documentation and inspect the server trace logs..
check your web.config files
1) Central admin,
2) C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\WebServices\SecurityToken
3) Your web app
in my case some wiered content added to my config file. please see below which is highlated with yellow color.
Under RoleManager section
=========================================
<add name="c" type="Microsoft.SharePoint.Administration.Claims.SPClaimsAuthRoleProvider,

Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral,
PublicKeyToken=71e9bce111e9429c" />
Under Membership section
=========================================
<membership defaultProvider="i" userIsOnlineTimeWindow="15" hashAlgorithmType="">
<providers>
<clear />
<add name="i" type="Microsoft.SharePoint.Administration.Claims.SPClaimsAuthMembershipProvider,

Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral,
PublicKeyToken=71e9bce111e9429c" />
</providers>
</membership>
remove unwanted data and iisreset.
it worked for me.
Thursday, November 1, 2012
Get all SharePoint Users and Groups using PowerShell Script
# it shows username, emailid, group names which user belogns to
# domainname\surya,
surya@xyz.com, group1; group2; group3;
copy below code to notepad file and save it as "users_groups.ps1" file.
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
$site = New-Object Microsoft.SharePoint.SPSite("http://spdev6:8003")
$web = $site.openweb("")
Write-Host $web.url
$i = 1
#logging
$timestamp = get-date -format "yyyyMMdd_hhmmtt"
$filenameStart = "UsersLog"
$logfile = ("{0}{1}.txt" -f $filenamestart, $timestamp)
$header = "UserName,Email,
Group"
$header | out-file -FilePath $logfile
write-host $i "UserName:" $user
"Groups:" $user.groups
#Write-Host
"siteusers" $web.siteusers["ajay.thomas"]
$semicolon = ";"
Write-Host $semicolon
foreach ($user in $web.siteusers)
{
#[string]$UserName=
$user.ToString()
#if
($UserName.ToUpper().StartsWith("surya"))
#{
foreach ($grp in $user.groups)
{
$str = $str + $grp.name + $semicolon
#Write-host $grp.name
";"
}
#Write-Host
$i $user
"," $user.email
"," $str
Write-Host $user "," $user.email "," $str "," $user.ID
# $user.group
$msg = ("{0},{1},{2}
" -f $user, $user.email, $str)
$msg | out-file -FilePath $logfile -append
$str= $null
#}
#Write-Host $i++
}
$site.Dispose()
Friday, August 3, 2012
SharePoint 2010: Custom Rss Feed for Document Library
Here is the good post for custom Rss Feed. It worked for me.
If you are working for document library replace “LinkTitle” with Title as shown below code.
foreach
(SPListItem item in items)
{
sb.Append("<item>");
AddTag("title",
item["Title"].ToString(), sb);
//AddTag("link",
list.RootFolder.Url + "/DispForm.aspx?ID=" + item.ID, sb);
// AddTag("link",
"http://site/News/default.aspx?itemid=" + item.ID, sb);
AddTag("link",
"http://site/news/default.aspx?itemid="
+ item.ID, sb);
//AddTag("link",
listurl + item.ID, sb);
sb.Append("<description>");
foreach
(string viewField in
view.ViewFields)
{
if (viewField != "Title")
//if
(viewField != "LinkTitle")
{
AddTag(viewField.Replace("_x0020_", "
"),item.GetFormattedValue(viewField), sb);
}
}
sb.Append("</description>");
sb.Append("</item>");
}
Subscribe to:
Posts (Atom)