Monthly Archives: April 2014

SharePoint – Hide Recently Modified (Wiki Library)

Hello everyone. Today I want to share my knowledge how to hide the Recently Modified Section located in the Quick Launch. Many people do not like it because it “breaks” the navigation. Like always there are many possibilities to achieve this, but I will show you the possibility I think is the best.

We will do the following:

  • Create a Custom CSS file which will disable Recently Modified for us
  • Enable necessary features
  • Upload our Custom CSS file to the SharePoint Style Library
  • Configure the SharePoint Site to use our CSS file

Recently Modified Before

sharepoint_recently_modified_before

Create Custom CSS file

Open Notepad and add the following code:

.s4-recentchanges
{
display: none;
}

Now save it as “HideRecentlyModified.css”.

Enable necessary features

Now you need to enable the necessary features

Site Settings Before

sharepoint_site_settings_before_features

Site Collection Features:

  • SharePoint Server Publishing Infrastructure

Site Features:

  • SharePoint Server Publishing

Site Settings After

sharepoint_site_settings_after_features

Upload our Custom CSS file to the SharePoint Style Library

Now go to All Site Content and go to the newly created Style Library. Create a new folder and call it “Custom” (This way you will be able to identify your changes when some time has passed). Now upload your Custom CSS file (HideRecentlyModified.css) to this folder.

sharepoint_style_library

Configure the SharePoint Site to use our CSS file

Go to Site Settings and click on Master Page under Look and Feel. There you will find the heading “Alternate CSS URL” where you need to choose the option Specify a CSS file to be used by this publishing site and all sites that inherit from it and select your Custom CSS file. Now click on OK and you´re ready to go.

When you now take a look at your Wiki Library you will notice that Recently Modified is gone.

sharepoint_recently_modfied_after

That´s it. Now Recently Modified will no longer be visible on this SharePoint Site. The big advantage of this method is that you can enable it on a per site level, combine this CSS setting with other settings and you can easily revert it. I hoped you liked my post.

Sources:

http://thepolymathlab.com/2012/12/02/hide-recently-modified-panel-in-sharepoint-2010/

http://thepolymathlab.com/2012/12/02/add-custom-css-to-sharepoint-2010-without-master-page/

http://troyscott.ca/2010/06/07/sharepoint-master-page-missing-from-look-and-feel/

Advertisements
Tagged ,

SharePoint – Send Files as Attachment

Hello everyone. Some days ago a colleague of mine asked me if it is possible to send files from SharePoint as an Attachment via mail. I told him it is possible and I want to show you how you can do this.

It is pretty simple to achieve this. All you need to do is the following:

  • Download the file from SharePoint and store it locally
  • Attach the file to your mail and send it
  • Delete the file

That´s all you need to do. But since we do not want to do it manually every time I created a short PowerShell Script which will do the work for me. (Of course you can do this in C# as well, but PowerShell seemed to be the quickest way to achieve this for me.)

Here is my Script:


#Get File from Webserver
function Get-FileFromWebServer
{
Param([parameter(Mandatory=$true)][alias("From")]$FromPath, [parameter(Mandatory=$true)][alias("To")]$ToPath)

#Split Path by "/" and store it in $Array
$Array = $FromPath.Split("/")

#Get filename from $Array
$FileName = $Array[($Array.Length-1)]

#Add filename to $ToPath
$ToPath = $ToPath + "\\" + $FileName

#Create new Instance of WebClient
$WebClient = New-Object System.Net.WebClient

#Use default credentials of the user account currently logged in
$WebClient.UseDefaultCredentials = $True
#Download the file from $FromPath and store it in $ToPath
$WebClient.DownloadFile($FromPath, $ToPath)

#Return $ToPath for later use
return $ToPath
}

#Send mail with Attachment
function Send-Mail
{
Param([parameter(Mandatory=$true)][alias("SMTP")]$SMTPServer, [parameter(Mandatory=$true)][alias("From")]$Sender, [parameter(Mandatory=$true)][alias("To")]$Receiver, [parameter(Mandatory=$true)][alias("Subject")]$SubjectString, [parameter(Mandatory=$true)][alias("Body")]$BodyMessage, [parameter(Mandatory=$true)][alias("Attachment")]$AttachmentFile)

#Create new SMTPClient Instance
$SMTPClient = New-Object Net.Mail.SMTPclient($SMTPServer)
#Create mail message object
$Message = New-Object Net.Mail.MailMessage($Sender, $Receiver, $SubjectString, $BodyMessage)
#Create Attachment and attach it to the mail message object
$Attachment = New-Object Net.Mail.Attachment($AttachmentFile)
$Message.Attachments.Add($Attachment)
#Send mail
$SMTPClient.Send($Message)

#Dispose $Attachment and $Message
$Attachment.Dispose()
$Message.Dispose()
}

#Download file from SharePoint and send it via mail as Attachment
function Send-FileFromSharePointAsAttachment
{
Param([parameter(Mandatory=$true)][alias("FromPath")]$FromPathString, [parameter(Mandatory=$true)][alias("ToPath")]$ToPathString, [parameter(Mandatory=$true)][alias("SMTP")]$SMTPServer, [parameter(Mandatory=$true)][alias("From")]$Sender, [parameter(Mandatory=$true)][alias("To")]$Receiver, [parameter(Mandatory=$true)][alias("Subject")]$SubjectString, [parameter(Mandatory=$true)][alias("Body")]$BodyMessage)

#Download file from Webserver and store Download Path
$ToPathString = Get-FileFromWebServer -FromPath $FromPathString -ToPath $ToPathString
#Send the file as Attachment
Send-Mail -SMTP $SMTPServer -From $Sender -To $Receiver -Subject $SubjectString -Body $BodyMessage -Attachment $ToPathString
#Delete the file from Download Path
Remove-Item $ToPathString
}

#Set variables
$FromPath = "http://sharepoint-portal.com/sites/TeamSite/Documents/ExampleDocument.docx"
$ToPath = "%userprofile%\AppData\Local\Temp"
$SMTPServer = "your-smtp-server.com"
$Sender = "firstname.lastname@company.com"
$Receiver = "firstname.lastname@company.com"
$Subject = "Attachment Test"
$Body = "This mail is a test."

#Execute Send-FileFromSharePointAsAttachment function
Send-FileFromSharePointAsAttachment -FromPath $FromPath -ToPath $ToPath -SMTP $SMTPServer -From $Sender -To $Receiver -Subject $Subject -Body $Body

That´s it. Now you know how you can send files from SharePoint as Attachment via mail. As always you can download my Script from here.

Sources:

http://techtrainingnotes.blogspot.co.at/2014/02/download-file-from-sharepoint-using.html

http://mspowershell.blogspot.co.at/2006/12/sending-emails-from-powershell.html

Tagged ,

Active Directory Search for Clients

Hello everyone. Today I discovered that there is a way to give non-admin users the possibility to search the Active Directory for information. It is pretty simple. All you need to do is to create this Shortcut on your users Desktops :

%SystemRoot%\System32\rundll32.exe dsquery,OpenQueryWindow

That´s it. That is all you need to do to make it work.

If you want to publish this Shortcut to a larger group of people you might consider using Group Policies.

The first step is to create a new Shortcut item. I called mine “Active Directory Search”.

ActiveDirectorySearch_GPO_Shortcut

Then I applied the following settings:

  • Target path: %SystemRoot%\System32\rundll32.exe
  • Arguments: dsquery,OpenQueryWindow
  • Location: Desktop

ActiveDirectorySearch_GPO_Shortcut_Properties_General

I would also recommend to apply the setting “Remove this item when it is no longer applied” to make sure the Shortcut will be removed when you want to retract this solution.

ActiveDirectorySearch_GPO_Shortcut_Properties_Common

If you configured everything correctly your Shortcut will appear on your users Desktops.

ActiveDirectorySearch_Shortcut

Now every time your users use this Shortcut this window will open allowing them to search your Active Directory.

ActiveDirectorySearch_AD_Users_and_Computers

Here is a screenshot of an example search:

ActiveDirectorySearch_AD_Users_and_Computers_Search_Result

Info: Don´t worry about users editing your Active Directory system. If they do not have the appropriate permissions to change things they will only be able to read information.

That´s it for today. I hope my post was useful for you.

Sources:

http://anandthearchitect.com/2010/05/08/windows-7-how-to-search-active-directory/

Tagged

Linux on Windows – With Putty & XMing

Hello everyone. Today I will show you how you can run Linux applications with a GUI on Windows by using Putty and XMing.

What operating systems you need:

  • A machine running a Linux operating system (for example: Ubuntu)
  • A machine running a Windows operating system (I used Windows 7)

What software you need:

Both will be run from your Windows machine. The only prerequisite you need to fulfill on your Linux machine is a running SSH server. When you use a debian system you can achieve this by simply running the following command:

sudo apt-get install openssh-server

Now log on to your Windows machine and install XMing. Simply click through the wizard and keep the default settings.

XMing_Finished_Installation

After the installation finished you need to allow XMing to bypass your firewall. To do so simply click on “Allow Access” when you run XMing.

XMing_Firewall

Now you need to configure Putty. Run Putty and enter the IP address or hostname of your Linux Machine and the number of the SSH Port you are using on this machine (The Default Port is 22). Enter a name for this Session in the textbox below “Saved Sessions” and click on Save.

Putty_Session

The next step is to configure the X11 forwarding. Go to Connection -> SSH -> X11. Check the checkbox next to “Enable X11 forwarding” and check the radio button next to MIT-Magic-Cookie-1 below Remote X11 authentication protocol. Now go back to Session and click on Save.

Now start the session by clicking on Open.

Putty_SSH

To test if everything is working you can run the following command:

xclock

Now this window will open up.

XMing_XClock

Important: If you try this and nothing happens, make sure that XMing is running and it can bypass your firewall.

That´s it. Now you can run Linux applications with a GUI via SSH on Windows.

Sources:

http://anotherdatabaseblog.blogspot.co.at/2012/10/putty-x11-proxy-wrong-authorisation.html

http://www.liberiangeek.net/2012/03/enable-ssh-secure-shell-in-ubuntu-12-04-precise-pangolin/

Tagged