Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,46 +11,25 @@ ms.localizationpriority: medium

In this step, you will create a project and add a reference to Microsoft.Office.Excel.Server.Udf.dll.





## Creating the Project

The following project uses Microsoft Visual Studio 2005.
The following project uses Microsoft Visual Studio 2022.

> [!NOTE]
> Depending on which settings you use in the Visual Studio integrated development environment (IDE), the process to create a project could be slightly different.



> Depending on which settings you use in the Visual Studio integrated development environment (IDE), the process to create a project could be slightly different.


### To create a project


1. Start Visual Studio.


2. On the **File** menu, point to **New**, and then click **Project**. The **New Project** dialog box appears.


3. In the **Project Type** pane, select **Visual C# Projects**.


4. In the **Templates** pane, click **Class Library**.


5. In the **Name** box, type **SampleUdf**.


6. In the **Location** box, type the path where you want to save your project, or click **Browse** to navigate to the folder.


7. Click **OK**. Your new project appears in **Solution Explorer**. You also will see that a file with the default name of Class1.cs has been added to your project.


8. You should see the following code in the Class1.cs file:
1. Start Visual Studio.
2. On the **File** menu, point to **New**, and then click **Project**. The **New Project** dialog box appears.
3. In the New Project dialog box, search for Class Library, and select the **C# language** filter.
4. In the **Name** box, type **SampleUdf**.
5. In the **Location** box, type the path where you want to save your project, or click **Browse** to navigate to the folder.
6. Click **OK**. Your new project appears in **Solution Explorer**. You also will see that a file with the default name of Class1.cs has been added to your project.
7. You should see the following code in the Class1.cs file:

```csharp

Expand Down Expand Up @@ -83,16 +62,11 @@ End Namespace
## Adding a Reference

The following steps show how to locate Microsoft.Office.Excel.Server.Udf.dll and how to add a reference to it.





### To add a reference


1. On the **Project** menu, click **Add Reference**.



2. In the **Add Reference** dialog box, on the **.NET** tab, select **Excel Services UDF Framework**.

> [!NOTE]
Expand All @@ -101,7 +75,7 @@ The following steps show how to locate Microsoft.Office.Excel.Server.Udf.dll and
3. Click **OK**.

> [!NOTE]
> The previous steps assume that you are building the project on a computer that has Microsoft SharePoint Server 2010 installed. On the computer where you have installed SharePoint Server 2010, you can find a copy of Microsoft.Office.Excel.Server.Udf.dll at: > [drive:]\\Program Files\\Common Files\\Microsoft Shared\\web server extensions\\14\\ISAPI
> The previous steps assume that you are building the project on a computer that has Microsoft SharePoint Server 2019 installed. On the computer where you have installed SharePoint Server 2019, you can find a copy of Microsoft.Office.Excel.Server.Udf.dll at: > [drive:]\\Program Files\\Common Files\\Microsoft Shared\\web server extensions\\16\\ISAPI

## See also

Expand Down
19 changes: 11 additions & 8 deletions docs/solution-guidance/create-remote-timer-jobs-in-sharepoint.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Examples of how timer jobs are used include:

## Before you begin

To get started, download the [Core.TimerJobs.Samples](https://github.com/pnp/PnP/tree/master/Solutions/Core.TimerJobs.Samples) sample add-in from the Office 365 Developer Patterns and Practices project on GitHub.
To get started, download the [Core.TimerJobs.Samples](https://github.com/pnp/PnP/tree/master/Solutions/Core.TimerJobs.Samples) sample add-in from the Microsoft 365 Developer Patterns and Practices project on GitHub.

> [!NOTE]
> The code in this article is provided as-is, without warranty of any kind, either express or implied, including any implied warranties of fitness for a particular purpose, merchantability, or non-infringement.
Expand All @@ -26,6 +26,9 @@ To start using the Core.TimerJobs.Samples solution, you need to select a startup
> [!NOTE]
> When you create a new project in Visual Studio, to start building your new remote timer job, add the OfficeDevPnP.Core NuGet package to your project. In Visual Studio, choose **TOOLS** > **NuGet Package Manager** > **Manage NuGet Packages for Solution**.

> [!NOTE]
> OfficeDevPnP.Core is deprecated. For new projects, use the PnP Core SDK instead.

### Schedule your remote timer job

A timer job can be scheduled to run once or can be a recurring job. To schedule your remote timer job in your production environment, you need to compile your code into an .exe file, and then run the .exe file by using Windows Task Scheduler or a Microsoft Azure WebJob. For more information, see [Timer job deployment options](timerjob-framework.md#timer-job-deployment-options).
Expand All @@ -34,11 +37,11 @@ A timer job can be scheduled to run once or can be a recurring job. To schedule

In **Core.TimerJobs.Samples.SimpleJob**, **Main** in Program.cs performs the following steps:

1. Creates a **SimpleJob** object, which inherits from the [OfficeDevPnP.Core.Framework.TimerJobs.TimerJob](https://github.com/SharePoint/PnP-Sites-Core/blob/master/Core/OfficeDevPnP.Core/Framework/TimerJobs/TimerJob.cs) base class.
1. Creates a **SimpleJob** object, which inherits from the [OfficeDevPnP.Core.Framework.TimerJobs.TimerJob](https://github.com/pnp/PnP-Sites-Core/blob/master/Core/OfficeDevPnP.Core/Framework/TimerJobs/TimerJob.cs) base class.

2. Sets the Office 365 user credentials to use when running the timer job by using **TimerJob.UseOffice365Authentication**. The user credentials must have appropriate access to the site collections. You can learn more at [Authentication](timerjob-framework.md#authentication).
2. Sets the Microsoft 365 user credentials to use when running the timer job by using **TimerJob.UseOffice365Authentication**. The user credentials must have appropriate access to the site collections. You can learn more at [Authentication](timerjob-framework.md#authentication).

3. Adds sites that the timer job should perform tasks on by using **TimerJob.AddSite**. Optionally, you can repeat the **TimerJob.AddSite** statement to add more than one site, or add all sites under a particular URL by using the wildcard character `*`. For example, `http://contoso.sharepoint.com/sites/*` runs the timer job on all sites under the **sites** managed path.
3. Adds sites that the timer job should perform tasks on by using **TimerJob.AddSite**. Optionally, you can repeat the **TimerJob.AddSite** statement to add more than one site, or add all sites under a particular URL by using the wildcard character `*`. For example, `https://contoso.sharepoint.com/sites/*` runs the timer job on all sites under the **sites** managed path.

4. Prints timer job information and runs the timer job by using **PrintJobSettingsAndRunJob**.

Expand Down Expand Up @@ -234,13 +237,13 @@ The **Core.TimerJobs.Samples.GovernanceJob** project uses timer jobs to ensure t

**SiteGovernanceJob\_TimerJobRun** is set as the event handler for the **TimerJobRun** event. When **TimerJob.Run** is called in Program.cs, **SiteGovernanceJob\_TimerJobRun** performs the following steps on each site collection that was added by using **TimerJob.AddSite** in Program.cs:

1. Gets the number of administrators assigned to the site collection by using the extension method [GetAdministrators](https://github.com/SharePoint/PnP-Sites-Core/blob/master/Core/OfficeDevPnP.Core/Extensions/SecurityExtensions.cs) which is part of [OfficeDevPnP.Core](https://github.com/SharePoint/PnP-Sites-Core/tree/master/Core/OfficeDevPnP.Core).
1. Gets the number of administrators assigned to the site collection by using the extension method [GetAdministrators](https://github.com/pnp/PnP-Sites-Core/blob/master/Core/OfficeDevPnP.Core/Extensions/SecurityExtensions.cs) which is part of [OfficeDevPnP.Core](https://github.com/pnp/PnP-Sites-Core/tree/master/Core/OfficeDevPnP.Core).

2. Uploads the JavaScript file to the SiteAssets or Style Library list by using [UploadFile](https://github.com/SharePoint/PnP-Sites-Core/blob/master/Core/OfficeDevPnP.Core/Extensions/FileFolderExtensions.cs), which is part of [OfficeDevPnP.Core](https://github.com/SharePoint/PnP-Sites-Core/tree/master/Core/OfficeDevPnP.Core).
2. Uploads the JavaScript file to the SiteAssets or Style Library list by using [UploadFile](https://github.com/pnp/PnP-Sites-Core/blob/master/Core/OfficeDevPnP.Core/Extensions/FileFolderExtensions.cs), which is part of [OfficeDevPnP.Core](https://github.com/pnp/PnP-Sites-Core/tree/master/Core/OfficeDevPnP.Core).

3. If the site has fewer than two administrators, [AddJSLink](https://github.com/SharePoint/PnP-Sites-Core/blob/master/Core/OfficeDevPnP.Core/Extensions/JavaScriptExtensions.cs) adds a notification message to a site by using JavaScript. You can learn more at [Customize your SharePoint site UI by using JavaScript](customize-your-sharepoint-site-ui-by-using-javascript.md).
3. If the site has fewer than two administrators, [AddJSLink](https://github.com/pnp/PnP-Sites-Core/blob/master/Core/OfficeDevPnP.Core/Extensions/JavaScriptExtensions.cs) adds a notification message to a site by using JavaScript. You can learn more at [Customize your SharePoint site UI by using JavaScript](customize-your-sharepoint-site-ui-by-using-javascript.md).

4. If the site has two or more administrators, the notification message is removed by using [DeleteJsLink](https://github.com/SharePoint/PnP-Sites-Core/blob/master/Core/OfficeDevPnP.Core/Extensions/JavaScriptExtensions.cs).
4. If the site has two or more administrators, the notification message is removed by using [DeleteJsLink](https://github.com/pnp/PnP-Sites-Core/blob/master/Core/OfficeDevPnP.Core/Extensions/JavaScriptExtensions.cs).


```csharp
Expand Down
23 changes: 10 additions & 13 deletions docs/solution-guidance/modules-sharepoint-add-in.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ The term *artifacts* is referred to throughout this article. Artifacts refers to

## High-level guidelines

As a rule of a thumb, we would like to provide the following high-level guidelines to deploy artifacts to SharePoint environments.
As a rule of thumb, we would like to provide the following high-level guidelines to deploy artifacts to SharePoint environments.

- Use the remote provisioning pattern (SharePoint Client Side Object Model and SharePoint REST API) to deploy artifacts to SharePoint environments.
- Do not use declarative code modules or feature framework XML files to deploy artifacts to SharePoint environments.
Expand All @@ -34,11 +34,11 @@ A big advantage of using code to deploy artifacts is you are able to debug the d

### Getting started

The following O365 PnP code samples demonstrate how to create a SharePoint Add-ins that use the remote provisioning pattern to deploy artifacts to a SharePoint environment.
The following Microsoft 365 PnP code samples demonstrate how to create SharePoint Add-ins that use the remote provisioning pattern to deploy artifacts to a SharePoint environment.

This sample demonstrates how to create a new folders in the Style Library and add JavaScript files and images to the new files.

- [Branding.ClientSideRendering (O365 PnP Code Sample)](https://github.com/SharePoint/PnP/tree/master/Samples/Branding.ClientSideRendering)
- [Branding.ClientSideRendering (Microsoft 365 PnP Code Sample)](https://github.com/SharePoint/PnP/tree/master/Samples/Branding.ClientSideRendering)
- See the ***UploadJSFiles*** and the ***UploadFileToFolder*** methods in the [Default.aspx.cs class](https://github.com/SharePoint/PnP/blob/master/Samples/Branding.ClientSideRendering/Branding.ClientSideRenderingWeb/Pages/Default.aspx.cs) for more details.
- These methods are also displayed below for quick reference.

Expand Down Expand Up @@ -115,7 +115,7 @@ The following O365 PnP code samples demonstrate how to create a SharePoint Add-i

This sample demonstrates how to upload master pages, set master page meta data and apply the master page to the site by setting the CustomMasterUrl property on the Web object.

- [Branding.ApplyBranding (O365 PnP Code Sample)](https://github.com/SharePoint/PnP/tree/master/Samples/Branding.ApplyBranding)
- [Branding.ApplyBranding (Microsoft 365 PnP Code Sample)](https://github.com/SharePoint/PnP/tree/master/Samples/Branding.ApplyBranding)
- See the ***UploadPageLayout***, ***CreatePublishingPage***, and ***SetSupportCaseContent*** methods in the [BrandingHelper.cs class](https://github.com/SharePoint/PnP/blob/master/Samples/Branding.ApplyBranding/Branding.ApplyBranding.Console/BrandingHelper.cs) for more details.
- In addition to creating new items in SharePoint, this sample demonstrates how to remove items. The methods which remove items are listed below for reference.
**Delete a file:**
Expand Down Expand Up @@ -199,11 +199,9 @@ This sample demonstrates how to upload master pages, set master page meta data a
}
```

- Watch the [Applying Branding to SharePoint Sites with an Add-in for SharePoint (Office 365 PnP Video)](https://channel9.msdn.com/Blogs/Office-365-Dev/Applying-Branding-to-SharePoint-Sites-with-an-App-for-SharePoint-Office-365-Developer-Patterns-and-P) for a walk through of this sample.
This sample has a little of everything in it. It demonstrates how to activate the publishing features, upload page layouts, create publishing pages, create lists, content types and list items, and creating publishing pages and adding web parts and Add-in Parts to the pages. It also demonstrates how to deploy list items to both the host web and the Add-in web.

This sample has a little of everything in it. It demonstrates how to activate the publishing features, upload page layouts, create publishing pages, create lists, content types and list items, and creating pblishing pages and adding web parts and Add-in Parts to the pages. It also demonstrates how to deploy list items to both the host web and the Add-in web.

- [Branding.ClientSideRendering (O365 PnP Code Sample)](https://github.com/SharePoint/PnP/tree/master/Samples/Branding.ClientSideRendering)
- [Branding.ClientSideRendering (Microsoft 365 PnP Code Sample)](https://github.com/SharePoint/PnP/tree/master/Samples/Branding.ClientSideRendering)
- See the methods in the [Utils.cs class](https://github.com/SharePoint/PnP/blob/master/Samples/Core.DataStorageModels/Core.DataStorageModelsWeb/Util/Util.cs) for examples of these operations.
- These methods are listed below for reference.

Expand Down Expand Up @@ -541,15 +539,14 @@ This sample has a little of everything in it. It demonstrates how to activate t

## PnP samples

- [Branding.ClientSideRendering (O365 PnP Code Sample)](https://github.com/SharePoint/PnP/tree/master/Samples/Branding.ClientSideRendering)
- [Branding.ApplyBranding (O365 PnP Code Sample)](https://github.com/SharePoint/PnP/tree/master/Samples/Branding.ApplyBranding)
- [Branding.ClientSideRendering (O365 PnP Code Sample)](https://github.com/SharePoint/PnP/tree/master/Samples/Branding.ClientSideRendering)
- [Branding.ClientSideRendering (Microsoft 365 PnP Code Sample)](https://github.com/pnp/PnP/tree/master/Samples/Branding.ClientSideRendering)
- [Branding.ApplyBranding (Microsoft 365 PnP Code Sample)](https://github.com/pnp/PnP/tree/master/Samples/Branding.ApplyBranding)
- Samples and content at [https://github.com/SharePoint/PnP](https://github.com/SharePoint/PnP)

## Applies to

- Office 365 Multi Tenant (MT)
- Office 365 Dedicated (D) *partly*
- Microsoft 365 Multi Tenant (MT)
- Microsoft 365 Dedicated (D) *partly*
- SharePoint 2013 on-premises – *partly*

*Patterns for dedicated and on-premises are identical with SharePoint Add-in model techniques, but there are differences on the possible technologies that can be used.*