What is causing a 404 error in VS and 405 error in the browser while creating a local Provider-Hosted app (not azure hosted) for SharePoint Online?

I am using Sharepoint Online and VS2019.

I was asked to create a Provider-Hosted App for SharePoint Online, where the App is hosted locally on a computer/server (without hosting on Azure).

As a test, I am trying to load the default Hello World Page that is auto-generated.

After Googling and watching YouTube videos to follow and understand some steps, I ended up using this guide (the closest guide I could find without mentioning hosting on Azure).

Now I completed the following:

  1. Created a Developer Site in Sharepoint Site Collection Created a

  2. Provider-Hosted MVC app for Sharepoint Online and using Windows Azure Access Control Service Created Self-Signed Certificate for default application pool.

  3. Create a Https binding to default localhost.
  4. Generated Client ID and Secret from Development site, then configured the App.

After deploying and starting the app, I noticed the messages followed by the error:enter image description here

Clicking on OK loads the following page,the 405 error- enter image description here

I am not really sure what I am doing wrong. Any assistance will be appreciated.

Creating DBMS based on DynamoDB

I’m developing a program that uses DynamoDB, for which my next step is to develop a simple DBMS that does the standard sorting by column (click to sort by firstname/lastname/emailaddress/etc….). Although a no-brainer in SQL, I can’t find a good way to do this in NoSQL except to brute-force it with a scan or query command (retrieving the whole DB every time I want to sort….obviously inefficient), or to make a whole bunch of secondary tables/indexes to handle each sort possibility. My question is whether there is any good/accepted/best-practice method of doing something like this, or if the only way to avoid the brute-force approach is to redo the whole thing in a SQL DB? Thanks.

Creating a PFX File for Wildcard SSL Certificate

I am trying to install a Wildcard SSL Certificate in IIS on Windows Server. It only accepts the .pfx file format for importing & installing an SSL certificate for hosted applications. I got the .csr file from CA as it was a wildcard cert.

I downloaded and installed OpenSSL for Windows (Latest version).

I placed the .crt file & .key file into C:\Program Files\OpenSSL-Win64\bin.

Then I ran this command to generate a random file:

set RANDFILE=C:\Program Files\OpenSSL-Win64\bin\<RANDOMFILENAME>.rnd 

Then I ran this command to give a path of config file:

set OPENSSL_CONF=C:\OpenSSL-Win64\bin\openssl.cfg 

Finally, I ran this command

openssl pkcs12 -export -out certificate.pfx -inkey privateKey.key -in certificate.crt 

The result of this was:

unable to load private key 140406554043456:error:0909006C:PEM routines: get_name:no start line:../crypto/pem/pem_lib.c:745:Expecting: ANY PRIVATE KEY 

I want to know if I’m making any mistake in the steps that I followed. I also want to know the reason of this error. I have the copy of private key & .crt file

Following are some more inputs which will make my question more specific.

  1. I have the copy of generated-private-key.key file & .crt file. I changed the file names before executing the OpenSSL command. I even created the random file & config file.

  2. The SSL certificate that I got from CA is a wildcard certificate, which I used to install on multiple subdomains of a customer. It was successful. Now while creating the .pfx file once again, I’m facing this problem.

  3. A .pfx file should be created only on the server which was used to create .csr file. In our case, we got the .csr file from CA as it was a wildcard certificate.

(Thanks in advance. Any help is appreciated)

Creating a PFX File for Wildcard SSL Certificate

I am trying to install a Wildcard SSL Certificate in IIS on Windows Server. It only accepts the .pfx file format for importing & installing an SSL certificate for hosted applications. I got the .csr file from CA as it was a wildcard cert.

I downloaded and installed OpenSSL for Windows (Latest version).

I placed the .crt file & .key file into C:\Program Files\OpenSSL-Win64\bin.

Then I ran this command to generate a random file:

set RANDFILE=C:\Program Files\OpenSSL-Win64\bin\<RANDOMFILENAME>.rnd 

Then I ran this command to give a path of config file:

set OPENSSL_CONF=C:\OpenSSL-Win64\bin\openssl.cfg 

Finally, I ran this command

openssl pkcs12 -export -out certificate.pfx -inkey privateKey.key -in certificate.crt 

The result of this was:

unable to load private key 140406554043456:error:0909006C:PEM routines: get_name:no start line:../crypto/pem/pem_lib.c:745:Expecting: ANY PRIVATE KEY 

I want to know if I’m making any mistake in the steps that I followed. I also want to know the reason of this error. I have the copy of private key & .crt file

Following are some more inputs which will make my question more specific.

  1. I have the copy of generated-private-key.key file & .crt file. I changed the file names before executing the OpenSSL command. I even created the random file & config file.

  2. The SSL certificate that I got from CA is a wildcard certificate, which I used to install on multiple subdomains of a customer. It was successful. Now while creating the .pfx file once again, I’m facing this problem.

  3. A .pfx file should be created only on the server which was used to create .csr file. In our case, we got the .csr file from CA as it was a wildcard certificate.

(Thanks in advance. Any help is appreciated)

Prevent members from creating unique permissions

I am managing a SharePoint site and realise that under Permissions I have a lot of documents that have unique permissions.

After checking, I realise this is due to the way the users share the document where it will create unique permission to the folder.

I have some folders that have restricted access but these are changes done by me. But the rest of the 50 over documents/folders shown with unique permissions are done by users.

I am wondering if changing the users’ permission can result in a neater permission management. At the moment the members are using the default ‘Edit’ permission.

Programmatically creating folders in lists results in invisible or incorrectly named folders

So far I’ve found two ways to create a folder via pnpjs-wrapped API calls. One, which is

SPList.rootFolder.folders.add("Name") 

works well for a document library, but, when used in a list, it results in having an invisible folder that you can access via URL, but can’t see in the list. Second way is

SPList.items.add({ Title: "Name", ContentTypeId: "0x0120" }) 

and it results in actually having two entities created in the list. One is a list item (in items collection) with the given name, which can be seen in the list and used to access the folder. Second is the actual folder (in folders collection), but its name is like #_.000 where # stands for the list item ID. And when I access the new folder I see the #_.000 name in breadcrumbs and in the URL, instead of given name.

In this case the item properties are like:

AssignedToId: null AssignedToStringId: null Attachments: false AuthorId: 10 Body: null Category: null Comment: null ComplianceAssetId: null ContentTypeId: "0x0120005B3A6725E6545840A09FDD3C367BC6FA" Created: "2019-06-21T04:54:58Z" EditorId: 10 FileSystemObjectType: 1 ForeignKeyId: null GUID: "b4ffd422-19e3-40ae-b58d-4c56280b159b" ID: 49 Id: 49 IssueStatus: null Line: null Modified: "2019-06-21T04:54:58Z" OData__UIVersionString: "1.0" Priority: null RelatedIssuesId: [] ServerRedirectedEmbedUri: null ServerRedirectedEmbedUrl: "" TaskDueDate: null Title: "MtFolder" V3Comments: null odata.editLink: "Web/Lists(guid'783d01c4-7dca-4ab2-aa7b-ca2e4c89283d')/Items(49)" odata.etag: ""1"" odata.id: "debe0338-9d3a-4770-94b0-aa54d92df311" odata.type: "SP.Data.LookupListListItem" 

The folder properties are like

Exists: true IsWOPIEnabled: false ItemCount: 0 Name: "49_.000" ProgID: null ServerRelativeUrl: "/Lists/LookupList/49_.000" TimeCreated: "2019-06-21T04:54:58Z" TimeLastModified: "2019-06-21T04:54:58Z" UniqueId: "a29e5616-a82d-475a-b649-94f926add5ab" WelcomePage: "" odata.editLink: "Web/GetFolderByServerRelativePath(decodedurl='/Lists/LookupList/49_.000')" odata.id: "https://contoso.sharepoint.com/_api/Web/GetFolderByServerRelativePath(decodedurl='/Lists/LookupList/49_.000')" odata.type: "SP.Folder" 

So I need that folder’s Name property to be the same as the item’s Title. This is not the case, obviously. But I can’t find any properties to link the folder with the item so that I could, for example, fetch the folder based on the item’s properties and update its name. There is something that looks like a link, however, in the item entity itself. For example, when handling the item.add() promise’s result, I can try:

.then(result => {     return result.item.folder.update({         Name: folderName     }); }) 

But this only returns 204 no content result, as if the folder wasn’t saved yet. Yet, it can be opened just a moment later with the same URL the folder.update() method tried to post the update info. I could probably wait and call the item.folder.update() a moment later, but what moment exactly? Don’t see a way to hook into the chain the moment the folder was saved.

So, this is my investigation so far.

Is there a way to hook into the result handling not for the new item, but for the attached folder? Or is there another method or a correct set of arguments for folders.add() or items.add() methods to create both the “folder-item” and the actual corresponding folder with correct name?

Best practice when creating classes that are solely in charge of the creation of other objects i.e. factories?

I often find myself creating classes that I suffix with ‘Factory’. These classes tend to be solely in charge of the creation of a specific class or set of related classes. However I’ve always felt that this probably isn’t best practice and that there’s a better way of approaching this. One of the reasons that I believe that this isn’t best practice is down to the fact that although I am using the ‘factory’ suffix I am not actually making use of the factory design pattern.

Let’s say I have an class vehicle, that contains two variables make and model. I want my problem to be able to create a number of these vehicle objects, so I want to encapsulate the code to create these objects in a single class. I might create the below class.

public class VehicleFactory {     public Vehicle CreateVehicle(string make, string model)     {          //create vehicle..          return vehicle;     } } 

The VehicleFactory can then be used wherever I want in my program without repeating the code and violating DRY.

I often need to create these kind of factory classes when I’m refactoring code, more specifically when I find two or more classes that are creating the same objects. I’d want to refactor the code by pulling out the repeated code and then placing it inside a specific factory class.

Is there a better way to approach this issue?

How to add email address as parameter while creating sharepoint group using Powershell

I’m trying to create sharepoint group and add site owner using :

$ Web.SiteGroups.Add($ GroupName, $ web.Site.Owner, $ web.Site.Owner, $ GroupDescription)

I would want to pass my email address instead of $ web.Site.Owner. When I try to pass the string value it throws the error :

Cannot convert the “XXX@XXX.com” value of type “System.String” to type “Microsoft.SharePoint.SPMember”

When creating teams, are there any differences if i add the user from sharepoint site or from Office 365 group or from MS Teams

Inside our office 365 tenant, i created a new MS Teams, as follow:- enter image description here

which also created new office 365 group + sharepoint modern team site. Now to add members or owners to the MS Teams, i found those 5 ways:-

  1. using the MS Team desktop app i can add members and owners.
  2. i login to office 365 admin center >> Office 365 Groups >> i can add members and owners.
  3. login to the sharepoint site >> click on “Site Permission” >> “Invite People” >> “add members to group”>>i can add members and owners.
  4. Inside the office 365 admin center >> MS Teams >> i can add members and owners.
  5. Finally if i went to office 365 admin center >> Active users >> click on a user >> Edit the user >> Edit “Group memberships” >>i can add the user to office 365 group.

so all of the above will add the user to the Office 365 either as Owner or member , and as so will grant the user access to Teams and the sharepoint site. But my question if adding users using the above 5 approaches will be exactly the same? or some approaches will not be the same as others?