Upload File Using WebApi

Below is the method you need to add to your ApiController to catch a file upload from client.

[HttpPost]
public async Task Upload()
{
MultipartMemoryStreamProvider stream = new MultipartMemoryStreamProvider();
await Request.Content.ReadAsMultipartAsync(stream);

// in case of multiple files uploading
foreach (HttpContent c in stream.Contents)
{
if (!string.IsNullOrEmpty(c.Headers.ContentDisposition.FileName))
{
// read file bytes and file name
string fileName = c.Headers.ContentDisposition.FileName.Replace("\"", string.Empty);
byte[] fileBytes = await c.ReadAsByteArrayAsync();
}
}

return Ok();
}
Advertisements

Project Server tab is Missing in TFS Workitem

If you mapped project plan to TFS team project, and after mapping you found that the Project Server tab is missing in TFS work-item form, then make sure that you are not using the key /skipUIChanges in the below command.

TfsAdmin ProjectServer /MapWorkItemTypes /collection:tpcUrl /teamProject:TeamProjectName /workItemTypes:ListOfWorkItemTypes

Enable IIS Dynamic Compression

IIS compression increase the performance and decrease the usage of network bandwidth.

There are two types of IIS compression:

  • Static: compress and cache compressed files like (*.html, *.htm,*.doc, *.xls, *.ppt,*.txt)
  • Dynamic: compress each http request without cache.

To enable Dynamic Compression ,please follow the below steps:

Windows 8

Go to Control Panel > Programs and Features

IISCompression1

 

 

 

Turn Windows features on or off

Internet Information Services > World Wide Web Services > Performance Features

IISCompression2

Windows Server 2008 R2

Go to Server Manager > Roles > Web Server (IIS) > Add Role Services

IISCompression8

IISCompression9

Windows Server 2012

Server Manger > Dashboard > Add roles and features

IISCompression3IISCompression4IISCompression6IISCompression5

IISCompression7

 

 

Is TFS 2013 Accessible During Scheduled Backup?

If you are taking backup for your TFS 2013 through “Scheduled Backups Wizard” from TFS Administration console, is the TFS will be accessible or not?

This question come to my mind, however, I tested it and I see that TFS will be online and accessible for readying and writing.

Which means, you can query your work items and update them as well.

TFSBackup.png

Release Locked (checked out) Document in SharePoint

As a feature in SharePoint, you can check out any document item.

Sometime, the user who check out the document library is not available and the admin need to release (undo check-out) the document library.

We can use the following power shell script (Change the bold values)

$WebSiteURL="http://sps-dev/"
$DocLibName="DocLib"
$ItemID=5

$web=Get-SPWeb $WebSiteURL
$item=$web.Lists[$DocLibName].GetItemById($ItemID)
$userId=$item.file.LockedByUser.ID
$user = $web.AllUsers.GetByID($userId)

$impSite= New-Object Microsoft.SharePoint.SPSite($web.Url, $user.UserToken)
$impWeb = $impSite.OpenWeb()
$impList=$impWeb.Lists["Appraisal"]
$impitem=$impList.GetItemById($item.ID)
$impitem.file.ReleaseLock($impitem.File.LockId)

 

Change Project Server 2013(EPM) Security Mode

In Project Server 2013 (EPM 2013) there are two security modes:

  • SharePoint Mode (Default)
  • Project Server Mode

In Project Server Mode, there are more customization security groups and other functionality that is distinct from SharePoint groups.

to switch between those modes, user SharePoint 2013 PowerShell console and run the below commands:

  • SharePoint Mode
Set-SPPRojectPermissionMode -Url http://WebApplication/pwa -AdministratorAccount Domain\serviceAccountName -Mode SharePoint
  • Project Server Mode
Set-SPPRojectPermissionMode -Url http://WebApplication/pwa -AdministratorAccount Domain\serviceAccountName -Mode ProjectServer

after using Project server mode, the security will look like below image:

ProjectServerSecurity

References: