Dave's Technophorical Times

A blog about Microsoft's Technologies!
SharePoint :: MVC :: ASP.NET :: IIS :: SQL Server :: Visual Studio :: MS Access

I had an issue recently where I was not able to remove an instance of SQl Server, or so I thought. I kept on trying to remove the instance via Microsoft SQL Server 2014 RATHER THAN Microsoft SQL Server 2014 (64-bit). Once I selected the 64 bit option in Add-Remove Features I was able to finally gett rid of the instance I didn't want! Pretty dumb of me to not see the 64 bit option right away but there you go, sometimes you can't see the forest for the trees. 



So you get this error when you try to deploy a report to SSRS from your Visual Studio Business Intelligence Studio: The permissions granted to user ' are insufficient for performing this operation. This can be the result of a few things.

1. The Folder that you are trying to deploy to does not exist or you don't have permission to create the folder.
2. You don't have permission for that folder!

BUT I'm the Admin, SA, big guy who owns everything so why the hell can't I deploy this dammed report!! It is more than likely that you have changed the permissions in the folder yourself and broken the parent inheritance and removed yourself at the same time. It happens! Or maybe someone else removed you. So how can you re-apply the permissions? You CAN’T do via the URL directly because that access is GONE. You need to launch SQL Server Reporting Services Configuration, then go to Report Manager URL and click on THAT LINK! Yeah, now you can reconfigure your messed up permissions.

Hope this helps someone else out one day!



Recently I had a request from a client to add a custom site collection column to all document libraries. This is pretty easy though the SharePoint UI of course, by creating a custom Site Column in the collection and adding it to the ‘Document’ content type.

However, in doing this the column is not added to the default view for any document libraries. This can be easily done using PowerShell using the script below. This adds the column to the default view in every document library throughout the entire site collection (referenced here).

$site = Get-SPSite “http://sharepoint.com”
$column = “Column”

$site | Get-SPWeb -limit all | ForEach-Object {

# Get all document libraries
$lists = $_.Lists | where  {$_.BaseType -eq “DocumentLibrary”}

# Loop libraries
for ($i = 0; $i -lt $lists.Count; $i++)
{

try
{

# Get current view
$view = $lists[$i].DefaultView

if($view)
{

# Delete if already exist
while($view.ViewFields.ToStringCollection().Contains($column))
{

$view.ViewFields.delete($column)
$view.Update()

}

# Add column
if(!$view.ViewFields.ToStringCollection().Contains($column))
{

$view.ViewFields.add($column)
$view.Update()

}

}

}
catch [Exception]
{

write-output (”  Error: ” + $_.Exception.ToString())

}

}

}

$site.Dispose()

You can also add views to a view by URL and view name for one specific view or list (a nice tip I found here). Here is another option by using GetViewFromUrl:

$spWeb = Get-SPWeb -Identity "http://mySharePoint"
$spView = $spWeb.GetViewFromUrl("/Lists/MyList/AllItems.aspx")
$spField = $spList.Fields["MyField"]
$spView.ViewFields.Add($spField)
$spView.Update()

You can also try to use SPList object as below:

$spList = Get-SPList -Url "http://mySharePoint/Lists/MyList"
$spView = $spList.Views["All Items"]
$spField = $spList.Fields["MyField"]
$spView.ViewFields.Add($spField)
$spView.Update()

Adding multiple columns to a view can also be done with PowerShell, and even create a new view and set it as the default view. This is really awesome if you want to leave the default ‘All Items’ view in tact, but create a new custom view and set it as default (found here):

Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue
$siteURL = "http://dev1share"
 $site = Get-SPSite($siteURL)
foreach($web in $site.AllWebs) {
$listCounter = $web.Lists.Count
 for($i=0;$i -le $listCounter;$i++) {
    $list = $web.Lists[$i]
     if($list.BaseType -eq "DocumentLibrary") {
     $newList = $web.Lists.item($list.ID);
  $viewfields = New-Object System.Collections.Specialized.StringCollection
   $viewfields.Add("DocIcon")
   $viewfields.Add("LinkFilename")
   $viewfields.Add("_UIVersionString")
   $viewfields.Add("Modified")
   $viewfields.Add("Created")
   $viewfields.Add("Editor")
   $viewfields.Add("FileSizeDisplay")
  [void]$newList.Views.Add("Detailed", $viewfields, "", 100, $true, $true)
   $newList.Update();
  $view=$newList.Views["Detailed"]
   $view.DefaultView = $true
   $view.Update()
 }
 }
$web.Dispose();
 }
 $site.Dispose();

 



The following PowerShell script crawls the specified lists, copies the fields from the All Items views and creates a new view named "Created By Me" and sets it as default. Tested with SharePoint 2010 but should work with 2013 as well. Tested with list but not with Document Libraries.

I used this script as a base.

$ver = $host | select version

if ($ver.Version.Major -gt 1) {$host.Runspace.ThreadOptions = "ReuseThread"} 

if ((Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue) -eq $null) 

{

 Add-PSSnapin "Microsoft.SharePoint.PowerShell"

}

 

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") 

 

$web = Get-SPWeb -Identity "http://portal/sites/Requests"

$lists=$web.Lists["User Request", "Hardware Request",  "Employee Request"]

$SourceView="All Items"

$NewViewName="Created By Me"

$NewViewDefault=$true

 

 

foreach($list in $lists) {

 

 $view = $list.Views[$SourceView]

 $Viewfields = $list.Views[$SourceView].ViewFields.ToStringCollection()

 $viewRowLimit="100"

 $viewPaged=$true

 $viewDefaultView=$NewViewDefault

 

# Setting the Query for the View

 $viewQuery = "<ORDERBY><FIELDREF name="" false="" ascending=""></FIELDREF></ORDERBY><WHERE><EQ><FIELDREF author="" name=""><VALUE type="" integer=""><USERID type="" integer=""></USERID></VALUE></FIELDREF></EQ></WHERE>"

 $viewName = $NewViewName

 

# Finally – Provisioning the View

 $myListView = $list.Views.Add($viewName, $viewFields, $viewQuery, 100, $True, $False, "HTML", $False)

 

# You need to Update the View for changes made to the view

# Updating the List is not enough

 $myListView.DefaultView = $True

 $myListView.Update()

 $list.Update()

}

$web.Dispose()



In this post we are going to see how to create Custom List from Power Shell in SharePoint 2013.

Create a SharePoint Custom List  Student Info with Columns
SNo    -  Number
SName  -  Text
Gender -  Choice
Photo  -  URL

#To which site u want to create the list
$spWeb=Get-SPWeb -Identity http://mySharePoint.ca

#List type or template
$spTemplate = $spWeb.ListTemplates["Custom List"]

#Get all the lists to the listcollection
$spListCollection=$spWeb.Lists

#adding the new list to the list collection
$spListCollection.Add("Studentlist","Studentlist",$spTemplate)

#get the path of subsite and sitecollecion
$path = $spWeb.url.trim()

#get the list to the list object
$spList = $spWeb.GetList("$path/Lists/Studentlist")

#adding the field type(Number) to the list
$spFieldType = [Microsoft.SharePoint.SPFieldType]::Number
$spList.Fields.Add("SNo",$spFieldType,$false)

#adding the field type(Text) to the list
$spFieldType = [Microsoft.SharePoint.SPFieldType]::Text
$spList.Fields.Add("SName",$spFieldType,$false)

#adding the field type(choice) to the list
$choices = New-Object System.Collections.Specialized.StringCollection
$choices.Add("Female")
$choices.Add("Male")
$spFieldType = [Microsoft.SharePoint.SPFieldType]::Choice
$spList.Fields.Add("Gender",$spFieldType,$false,$false,$choices)

#adding the field type(url) to the list
$spList.Fields.Add("Photo","URL",$false)

$Views = $spList.Views["All Items"]
$Views.ViewFields.Add("SNo")
$Views.ViewFields.Add("SName")
$Views.ViewFields.Add("Gender")
$Views.ViewFields.Add("Photo")

$Views.Update() - See more at: http://www.dotnetsharepoint.com/2013/06/how-to-create-list-using-power-shell.html#.U9_gPu90y9I



Original Post: https://knowledge.zomers.eu/SharePoint/Pages/How-to-remove-a-SharePoint-2010-Service-Application.aspx

It may be necessary to remove one or more Service Applications in SharePoint 2010. It has happened to me quite a few times alread that the Search Service Application got corrupt and needed to be recreated. Unfortunately often this isn't as easy as using the standard delete function in the ribbon. Luckily there are other ways to get it done.

First method - The official way

  1. Open up Central Administration
  2. Click on the link Manage service applications under Application Management

    SP2010RemoveServiceAppCentralAdminLink.png
  3. Click the row with the Service Application you wish to delete so it will be marked in blue. Click on the Delete button in the ribbon to initiate the deletion process. Allow a couple of minutes for it to complete. If it doesn't seem to complete after waiting at most 15 minutes, proceed with method 2 below.

    SP2010RemoveServiceAppDeleteLink.png

Second method - The PowerShell backdoor

  1. If the first method does not work, you can try it using a direct PowerShell command. Open up a PowerShell window on your SharePoint 2010 server.
  2. Type the following line to enable the SharePoint PowerShell AddIn for the current window:

    Add-PSSnapin Microsoft.SharePoint.PowerShell

    SP2010RemoveServiceAppAddPSSnapin.png

  3. Type the following command to list all the Service Applications available on your farm. Look for the one being the Service Application you want to delete and copy its value in the Id column:

    Get-SPServiceApplication

    SP2010RemoveServiceAppGetSPServiceAppId.png
  4. Type the following command to remove the Service Application. Provide the Id retrieved at the previous step behind the Identity parameter:

    Remove-SPServiceApplication -Identity <id>

    SP2010RemoveServiceAppCommand.png
    If this also takes a long time (allow it at most 15 minutes to complete), proceed with method 3 below.

Third method - The dirty way

If the two options above fail, there is stil the dirty way of forcing removal:

  1. Follow steps 1 to 3 from method 2 to retrieve the Id of the Service Application you wish to remove, if you haven't got this Id yet.
  2. Enter the following command to instruct removal of the Service Application. Replace <id> with the Id retrieved at the previous step:

    stsadm -o deleteconfigurationobject -id <id>

    SP2010RemoveServiceAppStsadmCommand.png

    Allow a couple of minutes for this to complete. If also this method seems to be stuck, leave the process running, open up services.msc via the Windows start menu and restart the SharePoint 2010 Timer Windows service. That should get the command to complete after which the Service Application should be gone.

    SP2010RemoveServiceAppTimerService.png
  3.  
Thanks and I hope this helps someone else too.


Sharepoint 2010 is here with powershell integration making it easy to change the passwords for sharepoint managed accounts whose passwords are not set to change automatically when nearing expiration. 

1) Change the password in AD for service account.

2) Update the password for the service accounts in the sharepoint 2010 farm .

Here is a quick run through

Change the password in AD for service account.

I assume  you can log on to a windows 2008 r2 server in domain where service account exists , you have rights to change the password for the service account. I am using a fictitious account  by the name _svc_acct for this scenario

a) After logging into a server in account domain  launch powershell

b ) Load the AD module

import-module activedirectory

c) Assign the account name to a variable

     $account="_svc_acct"

d) set the password ( please note this as we will be using this in the next section)

     Set-ADAccountPassword -Identity $account -OldPassword (ConvertTo-SecureString -AsPlainText  "xxxx" -Force) -NewPassword (ConvertTo-SecureString -AsPlainText "xxxxx" -Force)

e) Check for successful update of the password updation  ( out put should show recent tiem stamp)

Get-ADUser $account -properties * | select PasswordLastSet

For engineers who do not have windows 2008 r2 machines , you can always change password through your normal process.

Update the password for the service accounts in the sharepoint 2010 farm .

 a) Log on to the CA in the Farm, launch powershell.  Assign the new password from step d in the above section to a variable also store the account to a variable

$account="_svc_acct"

$securepassword=convertto-securestring "xxxxx" -asplaintext -force

b) Retrieve the Sp managed account   and pipeline it to the set-spmangedaccount cmdlet

Get-SPManagedAccount Domain\$account | Set-SPManagedAccount -ExistingPassword $securepassword -UseExistingPassword -confirm:$false



The entire Detail section of a Microsoft Access form goes blank sometimes. The text boxes you see in design view disappear when you go to use the form, leaving nothing but empty space.

The Cause

It happens when both these conditions are met:

  1. There are no records to display, and
  2. No new records can be added.

Condition (a) can be triggered in several ways. Examples:

  • The form's Data Entry property is set to Yes. (This means the form shows no existing records, i.e. it is for entering new ones only.)
  • The form has a Filter applied (or is opened with a WhereCondition) that yields no records.
  • The form is based on a query where the criteria yield no records.
  • The form is based on a table that has no records.

Condition (b) can be also be triggered by several things:

  • The form's Allow Additions property is set to No.
  • The form's Recordset Type property is set to something other than Dynaset.
  • The form is based on a read-only query. (If you cannot add a record directly to your query)

You can demonstrate the problem with any form, just by setting its Data Entry property to Yes, and Allow Additions to No.

If it has Form Header and Form Footer sections, controls in these sections will still be visible but they may not work properly.

Workarounds

You cannot prevent this from happening, unless you can avoid (a) and (b) being true at the same time.

If you have set Allow Additions to No so as to prevent new records, there is a simple workaround. Set Allow Additions back to Yes, so the form can show the new record when there are no others. You can prevent new records by canceling the BeforeInsert event of the form. Steps:

  1. Set the Before Insert property of the form to:    [Event Procedure]
  2. Click the Build button (...) beside this. Access opens the code window.
  3. Insert the line Cancel = True between the other two. The code will look like this:
        Private Sub Form_BeforeInsert(Cancel As Integer)
            Cancel = True
        End Sub

If you cannot prevent condition (b), you might be able to prevent condition (a). For example, if you are opening a form with a WhereCondition that could result in no records, you might prefer to display a dialog rather than the blank form. To do that, cancel the Open event of the form:

Private Sub Form_Open(Cancel As Integer)
    If Me.RecordsetClone.RecordCount = 0 Then
        Cancel = True
        MsgBox "No records"
    End If
End Sub

(Note: The procedure where you used OpenForm will be notified with error 2501 that the form did not open. Use error handling in that procedure to trap the message.)

There are times when you cannot prevent (a) and (b) happening together. A complex search form may have to use a read-only query, and the user's criteria may return no results. For these cases, place the criteria boxes in the form header section, and accept the fact that users will be okay if they see nothing when the search returns no results.

January 2010 update: In Access 2007 and later, check that the form's Filter On Load property is set to No so that it does not automatically apply a previously saved filter when you open  the form.



Problem: Customer discovered that the ULS logs had stopped generating. Within the Logs file there were files but from an old date.

Troubleshooting: I looked in Event viewer and found this:

Tracing Service failed to create the trace log file at location specified in SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\14.0\LogDir Error 0x0: The operation completed successfully. . Traces will be written to the following directory: C:\Windows\SERVIC~2\LOCALS~1\AppData\Local\Temp\.

Resolution:

  1. In Central Admin go to Monitoring>>Configure diagnostic logging
  2. changed the ‘Path’ value to C:\Temp and then back to D:\SharePoint\Logs or %CommonProgramFiles%\Microsoft Shared\Web Server Extensions\14\LOGS\, or whatever it was before! (changing it back and forth resolved this problem) 

The Event Log should stop reporting this error!

 



Had an issue with Audiences in Sharepoint 2010, Kept getting the error “There were problems searching audience, please contact the system administrator.” whenever I tried to add/target an audience in my Sharepoint 2010 in the Top Navigation.

What this error normally/really means is that Sharepoint cannot connect to the User Profile Service Application Proxy (You would get a similar error if your Enterprise search was trying to crawl your user profiles) or the User Profile Synchronization Serive (UPSS), which was my case.

To fix this you need to

  1. Open “Central Administration”
  2. Click “Application Management”
  3. Click “Manage Web Applications”
  4. Find and click on the “Web Application” or “Website” you are getting the error in (in my case ‘sharepoint -80′)
  5. Click “Service Connections” under the “Manage” ribbon
  6. Make sure that “User Profile Service Application” is checked (you may have to change from default to custom to be able to do this). This MIGHT be unchecked if you have recently deleted the default User Profile Service Application and created a new one using a different name, like I did, AND the Connection is NOT set to Default!!
"This worked great. The only other thing you need to do that wasn’t mentioned above is go to services in CA and make sure the user profile service is started.
Hope this helps someone else out there cos this took me 5 hours to figure out!
Dave


The Blogger

Dave Stuart I'm a Developer with a passion for coding. I enjoy the challengers that come with the job! SharePoint is one of my expert areas along with .NET Web Development with MVC and good old MS Access VBA coding. I Blog so that I can remember how I did that way back when; PLUS all this stuff is searchable! I constantly study and run my own business, Dafran Inc. I have passed 22 Microsoft Exams since 1998 when I first jumped on the treadmill of knowledge. I hope that you enjoy this Blog as much as I enjoy updating it. All the very best from Calgary, Alberta, Canada. contact me at linkedin @ dafran.ca

Calendar

<<  February 2017  >>
MoTuWeThFrSaSu
303112345
6789101112
13141516171819
20212223242526
272812345
6789101112

View posts in large calendar

Sign in