Dave's Technophorical Times

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

Log onto the Azure Portal, go to the App Services and select the App that you need to publish from Visual Studio to Azure.

Click on Get publish Profile. This downloads a Settings file.

In Visual Studio go to Publish and selete the "Import Profile" option.

Then import the Profile that you just exported from Azure. Done!



On local SQL Server database right-click on the database, Tasks, then Export Data-Tier Application to create a *.bacpac file.

Connect to the Azure database server via SSMS. Right-Click on the Azure Databases node. The Database cannot currently exist, so if it does it needs to be deleted first!

Select Import Data-tier Application and select the *.bacpac files that was created in the first step. This creates the database in Azure!

Don't forget to select the Edition of Microsoft Azure SQL Database before you complete the process.



More Info Here: https://stackoverflow.com/questions/21098333/visual-studio-compiles-fine-but-it-still-shows-red-lines Visual Studio 2019 is showing red underline all the time, even when it compiles fine!

Closing Visual Studio and removing the .vs folder located in the solution directory worked for me.

This folder has a hidden attribute. You may need to change settings in folder options to show hidden files.



Use this in the _layouts view to prevent the annoying left twitch if the content is longed than can fit on the display. The scrollbar moved the display to the left unless you put this in the _layouts View.

       /* prevent layout shifting and hide horizontal scroll */
        html {
            width: 100vw;
        }

        body {
            overflow-x: hidden;
        }


I recently came across a very annoying "feature" when developing an MVC5 site, and it took a few hours to resolve.

The white/blank above the navbar is the issue. To resolve this I added a margin-top: -50px in the Header of the _layouts view and all other _layouts that I had developed. Now it looks like this.

<style>
        body {
            margin-top: -50px;
        }
</style>



I just migrated a SharePoint side from 2010 Foundation to SharePoint 2013 Foundation and discovered that the most important column in my Libraries was no longer rendering the HTML it needed. Instead, it was just displaying the HTML. It should be displaying an image in the 15 Hive based on the Date Today and the Report Status. I discovered that Calculated Columns were now disabled by default in SharePoint 2013 and up and that I had to disable this by default. Using the PowerShell below I was able to disable it, however it still would not render the image. I then discoved that the Calculated Column MUST be a Number Data Type and NOT a Single Line of Text that it was in SharePoint 2010.

Just to add to the pain, I was using the Today trick for a column that is referenced in the formula. This is where you create a column that defaults to Today's Date, apply the formula and then delete the Today Column. I accomplished this using some PowerShell and at the same time changed the Data Type to a Number.

Switch if OFF - The Calculated Column Must be a Number output type
$webApp = Get-SPWebApplication https://mySPSite.com
$webApp.CustomMarkupInCalculatedFieldDisabled = $false
$webApp.Update()
Script for updating the Calculated column to a Number Data Type and with the Today Column Added and Deleted after the formula was updated.
if($doesTodayFieldExist -eq $false)
{	
	Write-Host "Creating Today Field" -ForegroundColor DarkBlue
	$dateTimeFieldType = [Microsoft.SharePoint.SPFieldType]::DateTime
	$fieldName = $list.Fields.Add("Today", $dateTimeFieldType, $false)
	$list.Fields[$fieldName].DefaultValue = "[Today]"
	Write-Host "Updating List"  -ForegroundColor DarkBlue
	$list.Update()
}

$field = $list.Fields["Status"]
if($field.Title -eq "Status" -and $field.Type -eq "Calculated")
{ 
	Write-Host "Updating Calculated Column" -ForegroundColor DarkBlue
	$field.Formula = "=Formula Goes here!"

	# For SharePoint 2013 and up this must be a number field
	$field.OutputType = [Microsoft.SharePoint.SPFieldType]::Number
	Write-Host "Updating Field" -ForegroundColor DarkBlue
	$field.Update()
	Write-host "Updating List" -ForegroundColor DarkBlue
	$list.Update()
}			

$field = $list.Fields["Today"]
if($field -ne $null)
{
	Write-host "Deleting Today Field" -ForegroundColor DarkBlue
	$field.Delete()	
	Write-host "Updating List" -ForegroundColor DarkBlue
	$list.Update()
}


This change was required for the SharePoint 2013 Upgrade (from SharePoint 2010), otherwise the page would only post back once and needed to be closed and re-opened to resubmit updates. The change was in private Control RenderHeaderBar()

var header2 = new HtmlGenericControl("h4");

string text2 = "Report ID:" + InspectionReportId + " GUID:" + InspectionReportGuid;

header2.InnerText = text2;

headerBox.Controls.Add(header2);



Found Here: .net - Authentication failed because remote party has closed the transport stream - Stack Overflow

I came across this issue when trying to send an e-mail to O365 via .NET C# code.

 

My Option is add the following Registry key:
Key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319 
Value: SchUseStrongCrypto 

It is worth noting that .NET 4.6 will use the correct protocol by default and does not require either solution.



Just as an FYI when moving from sharePoint 2010 to SharePoint 2013. The images folder is now accessed via _layouts/15/images. SharePoint 2010 was just _layouts/images!

Since the move to SharePoint 2013 requires that every reference to the “Hive” be prefixed with 15, and 16 for SharePoint 2016 etc, I have moved all logos and references to images to reference the images in the Style Library of each Site collection so that they will not break with consequent upgrades.



Aug
11

SQL White Spaces

by Dave Stuart | Tags:

I found myself with an issue with SQL Data. I could not trim the data with the trailing white space. Only this worked!

  UPDATE tblPipeClasses
  SET PipeClass =  Replace(PipeClass, Char(160),'')

I also wrote this function in VBA

Public Function RemoveExtendedAsciiCharacters(strString As String) As String

    Dim intCount As Integer    

    For intCount = 128 To 255

        If InStr(1, strString, Chr(intCount)) > 0 Then

            strString = Replace(strString, Chr(intCount), "")

        End If

    Next intCount    

    RemoveExtendedAsciiCharacters = strString

End Function

 



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

<<  March 2023  >>
MoTuWeThFrSaSu
272812345
6789101112
13141516171819
20212223242526
272829303112
3456789

View posts in large calendar

Sign in