Thursday, January 30, 2014

Local SMTP with Sharepoint 2013

Sharepoint isn’t very flexible when it comes to email server.

Enter the local smtpserver.

  1. Install SMTPServer
  2. Configure SMTP-Service using IIS6.0 Management Tools
    1. Access>Relay image
    2. Delivery>Outbound Security>basic authentication image
    3. Delivery>Outbound Connection> Specify TCP port
    4. Delivery>Advanced image
    5. All OK.
  3. Configure Centralt Administration>Web Application> Outgoing email = myserver.mydomain.local

It should work immediatly. No need to reset IIS or restart the smtpserver.

Sometimes youre mailing servers you cant verify settings on. Then Gmail can be used to verify the mailflow.

For google

  • Basic Authentication = myaccount@gmail.com , pwd: mypassword, use TSL
  • Use TCP port 587
  • Smarthost = smtp.gmail.com

To check email flow on local server, drive:\inetpub\mailroot\queue folder can be monitored. When mail is sent from sharepoint ,it lands in this folder while contacting the smtpserver. When there’s a problem, the mail will be stuck here. In some situations it might be needed to empty this folder, then content in this folder can be deleted if the iisadmin service first is stopped.

/>stop-service iisadmin

/>start-service iisadmin

/>start-service smtpsvc

References:

http://blogs.technet.com/b/yashgoel-msft/archive/2012/10/26/configuring-outgoing-email-settings-in-sharepoint-with-gmail-smtp.aspx

Sunday, January 26, 2014

Excel datedif formula

Useful excelformula that is hidden from the common gui, but present in all version of excel.

To compare a date to today

=DATEDIF(A1,TODAY(),"d")
Outputs difference in days. Can also return in complete months, years and then some.




















D

Number of days

MNumber of complete months
Y

Number of complete years

YD

Number of days excluding years

MD

Number of days excluding months and years

YM

Number of months excluding years


Note that on Swedish systems formulas look like this instead:


image


Comma is replaced by semicolon for some reason.


References:


http://excel.datedif.com/


http://stackoverflow.com/questions/10928586/excel-calculate-the-date-difference-from-today-from-a-cell-of-7-6-2012-102642

Friday, January 24, 2014

Windows phone on Windows 8.1

While trying to copy files to my Lumia 520, my windows didn’t show the phone in my computer.

To solve this

1. Install Window Phone App

http://www.windowsphone.com/en-au/how-to/wp8/windows-phone-app-for-desktop

Why? I don’t know, this is supposed to work out of the box. But it might be an issue since Lumia 520 is a pretty cheap issue.

Or the issue might be that Metro-phone app stole the attention.

This is how its supposed to look: image

Now we can copy files like an usual folder.

Now, how do we do this wirelessly?

Thursday, January 23, 2014

Thumbs in Searchresults in SP2010

Was working from sharepointblogs.com instructions trying to get Thumbnails from an Assetlibrary to be displayed in an Searchresultspage, but couldnt get the thumbs to stick.

Finally I tried removing “contentypeforsearch.=’image’  frome the xsl-customizations and it started working right away. Somehow the images in my results wasn’t interpreted as images. Maybe the .jpg filetype needs to added manually or something.

In this case, its a Imagesearch result page so the results are always images.

It works, im happy. customer happy. Done.

Before:

<xsl:when test="contenttypeforsearch[. = 'Image'] and contentclass[. = 'STS_ListItem_851']">

After:

<xsl:when test="contentclass[. = 'STS_ListItem_851']">

References:

http://blogs.msdn.com/b/david/archive/2011/06/27/previewing-audio-and-videos-in-sharepoint-2010-search-results.aspx

http://www.sharepointblog.com/2010/11/image-content-type-thumbnails-in-2010.html – the moneyshot

http://www.ableblue.com/blog/archive/2008/08/30/sharepoint-image-search-part-2/ – a bit old, still generally informational.

http://www.novolocus.com/2008/05/22/showing-thumbnails-in-search/

http://blogs.technet.com/b/anneste/archive/2008/11/25/mystery-solved-crawled-properties-in-sharepoint-part-5.aspx – details regarding how the crawling properties works.

Wednesday, January 22, 2014

Remove borders from View Style Boxed

 

For a case im using a link-list on a startpage. Reasons include making it easier for endusers to manage their own used applications, without rummaging around with tables etc.

For this reason the boxed view style served me well.

image

The box-borders gave an ugly look. To remove these, add content Editor webpart and insert

<style>
TD.ms-stylebox {
    BORDER:0 !important;
}</style>

Effect should be immediate.

image

Tuesday, January 21, 2014

Re-arm trial Server 2008+

While doing labs, applying snapshots and whatnot the licensekey sometimes disappears or you just dont wanna waste an activation on a testmachine.

To re-arm a Server triallicense

Elevated Cmd-prompt

Check current licenselevel

/>slmgr.vbs –dli

Extend the evalution period with another 60 days

/>slmgr.vbs –rearm

Server can be rearmed up to 3 times giving you a total of 240 days.

References:

http://support.microsoft.com/kb/948472

http://blogs.technet.com/b/johnbaker/archive/2009/08/29/extending-your-evaluation-activation-grace-period-on-windows-server-2008-and-2008-r2.aspx

Monday, January 20, 2014

Shared folders using ps

To create a shared folder using powershell

New-SmbShare –Name ShareName –Path C:\LocalFolder

To get permissions on existing

Get-SmbShareAccess –Name ShareName

 

References:

http://blogs.technet.com/b/josebda/archive/2012/06/27/the-basics-of-smb-powershell-a-feature-of-windows-server-2012-and-smb-3-0.aspx

Thursday, January 16, 2014

Filtrera listvyer med localized Sharepoint

För en lokaliserad version av Sharepoint 2010 så används även svenska på de logiska funktionerna. Det är väl ok, när man kommer till ro med att det går att använda åäö på funktioner “Date=Datum,Year=År,Month=Månad etc”. Det som är knepigare att få grep och är varför de bytt ut skiljetecknen!

För att få fram en första dagen i en månad baserat på ett datumfält så funkar i Engelsk version denna:

=DATE(YEAR([Due Date]), MONTH([Due Date]), 1)
Motsvarande funktion på Svensk version:
=DATUM(ÅR(visning);Månad(visning);1)
Notera att “,” är utbytt emot “;” på svensk version. 

Så för att filtrera en listvy baserad på vilken månad som är angivet i ett fält kan följande metod användas.



  1. Skapa kolumn Visning(datumtyp)

  2. Skapa kolumn MonthEnd(beräknad) : formel =DATUM(ÅR(visning);Månad(visning);1)  output=dateimage[6]

  3. Skapa kolumn MonthStart(beräknad) : formel=DATUM(ÅR(visning);månad(visning)+1;1)-1   output=date

  4. Skapa vy,


    1. filtrera med MonthStart är mindre än eller lika med [I dag]

    2. Filtrera med MonthEnd är större än eller lika med [I dag]

imageimage


image


References:


http://iwillsharemypoint.blogspot.in/2012/03/sharepoint-list-view-of-current-month.html

http://kalsing.blogspot.in/2006/02/sharepoint-list-group-by-month.html

http://blog.pentalogic.net/2009/11/howto-filter-items-current-calendar-month-view-sharepoint/

Taskmanagement in powershell

My favorite commands tasklist and taskkill are getting old. Time to get on the powershell bandwagon now when xp is losing its supported-status.

For tasklist-like results

/>get-process |where-object {$_.processname –like msiexec}

Where msiexec is queried process

For taskkill-like results

/>stop-process –name notepad

Where notepad is process to be killed.

Also nice to have

/>restart-computer

Which is pretty obvious. Restart immediatly on default. Use with scheduler for more use.

References:

http://technet.microsoft.com/en-us/library/hh849837.aspx - restart-computer

http://technet.microsoft.com/en-us/library/ee177004.aspx - stop process

http://technet.microsoft.com/en-us/library/hh849781.aspx - stop process

http://technet.microsoft.com/en-us/library/hh849832.aspx - get process

http://www.powershellmagazine.com/2012/11/27/better-restart-computer-cmdlet-in-powershell-3-0/ - restart-computer enhancements in ps3.0

http://jrich523.wordpress.com/2012/11/28/using-powershell-schedule-job-to-reboot-a-computer/

Friday, January 10, 2014

Free up space in Windows 8

This is sort of up there in terms of freeing up space. A bit over the top for the ordinary users.
There is however a method of removing the install files for Windows features you don’t need. It goes like this:
/>dism.exe /online /disable-feature /featurename:sua /remove
But if you want to remove a lot of not needing features this could be tedious. enter powershell
------------flushfeatures.ps1-----------
foreach ($item in get-content featuresclean.txt)
{
write-host "Removing feature $item"
dism.exe /online /disable-feature /featurename:$item /remove
    }
-----------eof-------------
Where featuresclean.txt is a file where every line contains a feature to be flushed.
To get all windowsfeatures on the system in a single list it can be a bit tricky.
I solved it a bit rough bit
/>get-windowsoptionalfeature –online |? state –eq ‘disabled’ |export-csv output.csv
and then copied the relevant columns from the csv to featuresclean.txt
Really not recommended if you don’t know what your doing
References:
http://technet.microsoft.com/en-us/magazine/2007.04.powershell.aspx
http://blogs.technet.com/b/joscon/archive/2012/11/20/features-on-demand-in-windows-8-and-windows-server-2012.aspx
http://technet.microsoft.com/en-us/library/hh824822.aspx
http://www.howtogeek.com/174705/how-to-reduce-the-size-of-your-winsxs-folder-on-windows-7-or-8/

Tiny calender in SP 2010

Customer want a small calenderview. Like the one in Outlook.image

This can be achived using all built in tools with some css tinkering.

You need:

  • A calenderlist using a calenderbased view
  • A content editor web part

Steps:

  1. Insert webpart using calenderview
  2. Insert webpart content editor webpart (CEWP)
  3. Edit CEWP

<style>
.ms-acal-header TD {
    VERTICAL-ALIGN: top
}
.ms-acal-rootdiv TD {
    VERTICAL-ALIGN: top
}
.ms-acal-rootdiv TH {
    VERTICAL-ALIGN: top
}
.ms-acal-rootdiv {
    OVERFLOW: hidden; FLOAT: right; MARGIN-LEFT: 0px
}
.ms-acal-vitem {
    VISIBILITY: hidden; BACKGROUND-COLOR: #f2f2f2
}
.ms-acal-month-weeksel {
    WIDTH: 5px; VISIBILITY: hidden
}
.ms-acal-summary-dayrow TH {
    CURSOR: pointer; BORDER-TOP: #b6c5c6 0px solid; BORDER-RIGHT: #b6c5c6 0px solid; BORDER-BOTTOM: #b6c5c6 0px solid; BORDER-LEFT: #b6c5c6 0px solid; VISIBILITY: hidden; BACKGROUND-COLOR: #ced8d9
}
.ms-acal-month-top {
    WIDTH: 20px; BORDER-BOTTOM: #b6c5c6 1px solid; COLOR: #919649; PADDING-BOTTOM: 2px; TEXT-ALIGN: center; PADDING-TOP: 2px; PADDING-LEFT: 2px; PADDING-RIGHT: 2px
}
.ms-acal-summary-dayrow TH {
    CURSOR: pointer; BORDER-TOP: #b6c5c6 0px solid; HEIGHT: 0em; BORDER-RIGHT: #b6c5c6 0px solid; BORDER-BOTTOM: #b6c5c6 0px solid; BORDER-LEFT: #b6c5c6 0px solid; VISIBILITY: hidden; BACKGROUND-COLOR: #ced8d9
}
.ms-acal-summary-itemrow TD DIV {
    HEIGHT: 0px; WIDTH: 0px
}
.ms-acal-vlink IMG {
    VISIBILITY: hidden; MARGIN-RIGHT: 3px
}
.ms-acal-vlink A:hover {
   
}</style>

4. Save

Now this view will expand the row if there is an item on that week. Not so pretty, but itll work for this case.

  • Onhover on date the events of that day should be displayed
  • Date should be bold or different color if their is events on that day.

image

References:

http://www.sharepointgrind.com/Lists/Posts/Post.aspx?ID=19

http://blog.pathtosharepoint.com/2008/10/06/tiny-sharepoint-calendar-1/

http://erikswenson.blogspot.se/2013/04/small-calendar-for-sharepoint-2010-2013.html

Wednesday, January 08, 2014

Useful ps filters

To filter results from a powershell query where-object can be used.

For example to filter get-spserviceapplication by field typename

/>Get-spserviceapplication |where-object{$_.typename –like “Search Service”

will result in all objects that contains Search Service. Switch –like for –eq to more precise results.

To get specific field to a variable

/>$serviceid = Get-spserviceapplication |where-object{$_.typename –like “Search Service”  |select id

Simple but powerful.

References:

http://windowsitpro.com/powershell/where-object-filter-filters

Firefox Disable full screen warnings

To get rid of annoying full screen warnings in Firefox

image

  1. About:config
  2. Set Full-screen-api.approval-required to false.
  3. Restart Firefox

image