Change Gallery Line Item Background When Selected

I was doing a sample app today and came upon a scenario where I had to change the background colour of a line in a gallery when it is selected (using a checkbox). After doing some digging, I picked up that you have to change the TemplateFill property of the gallery which controls each line. An example below:

TemplateFill Property (Gallery level):

SampleApp1

Gallery In Preview Mode:

SampleApps1

This makes it so much easier to select multiple options into a collection..

..Aadil

 

Advertisements

Check In All Items In Library Using Powershell

During an implementation of some web parts we faced an issue where a slider web part would not show images. After some digging we found that we had to check in all new images that were loaded or the images would not show on the actual web part, this happen across all web parts that used images and is part of the SharePoint publishing feature.

To check in images one by one would be quite cumbersome, luckily however, we have PowerShell to help us out.

The PowerShell code below, courtesy of SharePoint Diary really assisted us in our situation. Use the below in PowerShell in order to check all items in.. You can add your site and library to match your environment..

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Variables for Site URL and Library Name
$WebURL="http://SharePointSiteName/"
$LibraryName="LibraryName"

#Get Site and Library
$Web = Get-SPWeb $WebURL
$DocLib = $Web.Lists.TryGetList($LibraryName)

#Get all Checked out files
$CheckedOutFiles = $DocLib.Items | Where-Object { $_.File.CheckOutStatus -ne "None"}

#Check in All Checked out Files in the library
ForEach($item in $CheckedOutFiles)
{
#If you want to update fields
#$item["Field"] = "value"
#$item.SystemUpdate()

#check in file programmatically
#$item.TakeoverCheckout()
$DocLib.GetItemById($item.Id).file.CheckIn("Checked in by Admin")
write-host "File:'$($item.Name)' has been checked in!"
}

 

 

Hope this helps someone out there!

Delete All Items In A SharePoint List

OOTB SharePoint allows you to delete a maximum of 99 items at once from a list. This isn’t usually an issue when you have smaller lists, however, once your lists start going into 1000’s, this really does become an issue.

I don’t usually don’t count these blog posts as code solutions because they’re not really code, just scripts that can be run to make it easier dealing with SharePoint here and there!

Also with the amount of amazing posts out there related to SharePoint I am sure you will find many posts showing similar ways of doing this. I found this script a while back and can’t be too sure as to the source, however, kudos to the script writer/poster.

You can run the below code as an admin in a SharePoint PowerShell elevated command window.


$web = get-spweb http://TYPE SITE HERE
$list = $web.lists | where {$_.title -eq "TYPE LIST NAME HERE"}
Write-host "List $($list.title) has $($list.items.count) entries"
$items = $list.items
foreach ($item in $items)
{
Write-host " Say Goodbye to $($item.id)" -foregroundcolor red
$list.getitembyid($Item.id).Delete()
}

 

Sign In As Another User SharePoint 2013 – The Same But Easier Approach

I was browsing a site the other day looking for an answer to something hoping someone had come across as well and what do you know? I came across something as well.

Very similar to my previous post, but now you don’t have to type in the address bar all the time. You can save the below link as a bookmark/favorite and the JavaScript will basically add your URL to a string and will ask you to sign in again. Easier when you’re in a hurry and also to avoid typos!

Save below as a bookmark:

javascript:(function(){var ctx=new SP.ClientContext.get_current();var web=ctx.get_web();ctx.load(web,'Url');ctx.executeQueryAsync(Function.createDelegate(this,success),Function.createDelegate(this,failed));function success(sender,args){var url=web.get_url();window.location=url+'/_layouts/closeConnection.aspx?loginasanotheruser=true';};function failed(sender,args){alert('Error\n'+args.get_stackTrace());};})();

Source

Enjoy!

Application Pool Stopping When Running 32-Bit Non-SharePoint Sites In IIS

Whilst moving a site over from one server to another, I ran into slight issues isn’t too hectic to sort out.

The source server where the site was hosted was not a SharePoint Server, rather just a basic server to host some websites, plain and simple.

The destination server was however a SharePoint server. The website being hosted needed its AppPool to be run in 32-bit mode, but when hosting 32-bit websites on a SharePoint server it gives the error in the event viewer:

“The Module DLL ‘C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\isapi\spnativerequestmodule.dll’ could not be loaded due to a configuration problem. The current configuration only supports loading images built for a x86 processor architecture. The data field contains the error number. To learn more about this issue, including how to troubleshooting this kind of processor architecture mismatch error, see http://go.microsoft.com/fwlink/?LinkId=29349.”

With this error, your web application’s AppPool will stop by itself once you browse to your application.

To fix this you can run the following command that allows 32-bit applications to run by redirecting the spnativerequestmodule.dll to run only when 64-but application need it.

You can run the code in an elevated Command Prompt session:

<pre id="pre485695" class="prettyprint notranslate"><span class="code-string">"</span><span class="code-string">%systemroot%\system32\inetsrv\AppCmd.exe"</span> set config -section:system.webServer/globalModules /<span class="code-keyword">[</span><span class="code-keyword">name='SPNativeRequestModule']</span>.preCondition:integratedMode,bitness64</pre>

Source:

Code Project

Manas Bhardwaj’s Stream

 

 

Unable To login To Fully Qualified Domain Name SharePoint Site On Host Server

My password is correct, I know it is, its what I used to log in to this server, BUT WHY DOES IT KEEP ASKING ME FOR A USERNAME AND PASSWORD.

How could I not know that when you try to access a SharePoint Site which has Fully Qualified Domain Name on the its host server it does a LoopBackCheck that keeps asking for a username and password.

Basically, you have a server called SharePoint and on it you have multiple Web Applications with different Host Headers. The Host Header allows the DNS to properly point you to the right SharePoint Site when multiple sites are on point 80.

So when we try to access http://company on the SharePoint server it will keep asking for a username and password because it does a LoopBack check. Apparently its a security feature as part of windows.

Follow the cool blog below that will show you how to disable it.

How To Disable Loop Back Check On Windows Server

Thanks To Robyn Cerda & Teddy Gonzalez for the cool blog posts.

 

 

InfoPath Button Rendering (Button Cutting Off)

Just a quick one…

So i I have had a silly issue pop up on InfoPath when using buttons. What happens is when you use some rules to hide and show buttons, sometimes the button doesn’t render properly and shows a thin line as a button rather then the actual button

 

InfoPath Button Render1

So after doing some research it turns out that it does this because (probably) the button has its height property set to Auto. I haven’t tried it with the width that could also be an issue as well.

InfoPath Button Render2

After you set your height manually and publish the form when the rules run and the button has to show, the rendering should be a bit better.

InfoPath Button Render3

InfoPath Button Render4.png