├── .gitattributes ├── .gitignore ├── 365-Project-Online-OM-ProjToolV2 ├── 365-Project-Online-OM-ProjToolV2.sample.yml ├── LICENSE ├── ProjToolV2 │ ├── App.config │ ├── AppSettings.Designer.cs │ ├── AppSettings.cs │ ├── AppSettings.resx │ ├── Creation │ │ ├── CustomFieldsCreation.Designer.cs │ │ ├── CustomFieldsCreation.cs │ │ ├── CustomFieldsCreation.resx │ │ ├── LookupTablesCreation.Designer.cs │ │ ├── LookupTablesCreation.cs │ │ ├── LookupTablesCreation.resx │ │ ├── ProjectsCreation.Designer.cs │ │ ├── ProjectsCreation.cs │ │ ├── ProjectsCreation.resx │ │ ├── ResourcesCreation.Designer.cs │ │ ├── ResourcesCreation.cs │ │ └── ResourcesCreation.resx │ ├── Images │ │ ├── Project.ico │ │ ├── Project.png │ │ ├── Project.xcf │ │ ├── logs.png │ │ ├── popout.png │ │ ├── refresh.png │ │ └── settings.png │ ├── LoginPage.Designer.cs │ ├── LoginPage.cs │ ├── LoginPage.resx │ ├── Manage │ │ ├── CheckInCheckOut.Designer.cs │ │ ├── CheckInCheckOut.cs │ │ ├── CheckInCheckOut.resx │ │ ├── ProjectOwner.Designer.cs │ │ ├── ProjectOwner.cs │ │ ├── ProjectOwner.resx │ │ ├── ProjectTeamBuilder.Designer.cs │ │ ├── ProjectTeamBuilder.cs │ │ ├── ProjectTeamBuilder.resx │ │ ├── ProjectsPublish.Designer.cs │ │ ├── ProjectsPublish.cs │ │ ├── ProjectsPublish.resx │ │ ├── ServerObjectsDelete.Designer.cs │ │ ├── ServerObjectsDelete.cs │ │ └── ServerObjectsDelete.resx │ ├── ProjToolV2.csproj │ ├── ProjToolV2.sln │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ ├── Resources.Designer.cs │ │ ├── Resources.resx │ │ ├── Settings.Designer.cs │ │ └── Settings.settings │ ├── ServerMain.Designer.cs │ ├── ServerMain.cs │ ├── ServerMain.resx │ ├── Update │ │ ├── ProjectUpdater.Designer.cs │ │ ├── ProjectUpdater.cs │ │ └── ProjectUpdater.resx │ ├── Utilities │ │ ├── BackgroundExecutorWithStatus.cs │ │ ├── BackgroundWorkerBase.cs │ │ ├── BaseForm.cs │ │ ├── BaseForm.resx │ │ ├── CsomBase.cs │ │ ├── CsomHelper.cs │ │ ├── LogUtility.cs │ │ └── Utils.cs │ ├── packages.config │ └── project.ico └── readme.md ├── Copy-Work-Packages ├── Copy-Work-Packages.sample.yml ├── Copy-Work-Packages.sln ├── Copy-Work-Packages │ ├── AppManifest.xml │ ├── Content │ │ ├── App.css │ │ ├── Elements.xml │ │ └── SharePointProjectItem.spdata │ ├── Copy-Work-Packages.csproj │ ├── Copy-Work-Packages.csproj.user │ ├── Features │ │ └── CopyWorkTasks │ │ │ ├── CopyWorkTasks.Template.xml │ │ │ └── CopyWorkTasks.feature │ ├── Images │ │ ├── AppIcon.png │ │ ├── Elements.xml │ │ └── SharePointProjectItem.spdata │ ├── Package │ │ ├── Package.Template.xml │ │ └── Package.package │ ├── Pages │ │ ├── Default.aspx │ │ ├── Elements.xml │ │ └── SharePointProjectItem.spdata │ └── Scripts │ │ ├── App.js │ │ ├── Elements.xml │ │ ├── SharePointProjectItem.spdata │ │ └── _references.js └── README.md ├── Create-Update-Project-Samples ├── Create-Update-Project-Samples.sample.yml ├── Create-Update-Project-Samples.sln ├── Create-Update-Project-Samples │ ├── App.config │ ├── CreateProject.cs │ ├── CreateUpdateProjectSample.cs │ ├── CreateUpdateProjectSamples.csproj │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── UpdateProject.cs │ ├── UpdateProjectCustomFieldValues.cs │ └── dll │ │ ├── Microsoft.ProjectServer.Client.dll │ │ ├── microsoft.sharepoint.client.dll │ │ └── microsoft.sharepoint.client.runtime.dll └── README.md ├── My-Task-Checklist ├── ClaimsAuth │ ├── ClaimClientContext.cs │ ├── ClaimsAuth.csproj │ ├── ClaimsAuth.sln │ ├── ClaimsWebAuth.cs │ ├── Constants.cs │ ├── CookieReader.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ └── packages.config ├── My-Task-Checklis.sample.yml ├── My-Task-Checklist.sln ├── My-Task-Checklist │ ├── App.config │ ├── Assignment.cs │ ├── My-Task-CheckList.cs │ ├── My-Task-Checklist.csproj │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ ├── Resources.Designer.cs │ │ ├── Resources.resx │ │ ├── Settings.Designer.cs │ │ └── Settings.settings │ ├── frmCheckList.Designer.cs │ ├── frmCheckList.cs │ └── frmCheckList.resx └── README.md ├── O365-Project-Online-JavaScript-Samples ├── O365-Project-Online-JavaScript-Samples.sample.yml ├── README.md ├── createproject.js ├── updateproject.js └── updateprojectcustomfieldvalues.js ├── O365-Project-Online-REST-Samples ├── O365-Project-Online-REST-Samples.sample.yml ├── README.md ├── ReST.ps1 ├── createproject.ps1 ├── updateproject.ps1 └── updateprojectcustomfieldvalues.ps1 ├── README.md ├── SECURITY.md └── SSIS-Package-ODATA-Delta-Sync ├── LICENSE ├── Project_Online_SSIS_Delta_Sync.pdf ├── SSIS Package for Sync.sln └── SSIS Package for Sync ├── DeleteOldProjects.dtsx ├── OData Source.conmgr ├── ODataSync.dtsx ├── Project.params ├── SQL Database.conmgr ├── SSIS Package for Sync.database └── SSIS Package for Sync.dtproj /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | build/ 21 | bld/ 22 | [Bb]in/ 23 | [Oo]bj/ 24 | 25 | # Visual Studio 2015 cache/options directory 26 | .vs/ 27 | 28 | # MSTest test Results 29 | [Tt]est[Rr]esult*/ 30 | [Bb]uild[Ll]og.* 31 | 32 | # NUNIT 33 | *.VisualState.xml 34 | TestResult.xml 35 | 36 | # Build Results of an ATL Project 37 | [Dd]ebugPS/ 38 | [Rr]eleasePS/ 39 | dlldata.c 40 | 41 | # DNX 42 | project.lock.json 43 | artifacts/ 44 | 45 | *_i.c 46 | *_p.c 47 | *_i.h 48 | *.ilk 49 | *.meta 50 | *.obj 51 | *.pch 52 | *.pdb 53 | *.pgc 54 | *.pgd 55 | *.rsp 56 | *.sbr 57 | *.tlb 58 | *.tli 59 | *.tlh 60 | *.tmp 61 | *.tmp_proj 62 | *.log 63 | *.vspscc 64 | *.vssscc 65 | .builds 66 | *.pidb 67 | *.svclog 68 | *.scc 69 | 70 | # Chutzpah Test files 71 | _Chutzpah* 72 | 73 | # Visual C++ cache files 74 | ipch/ 75 | *.aps 76 | *.ncb 77 | *.opensdf 78 | *.sdf 79 | *.cachefile 80 | 81 | # Visual Studio profiler 82 | *.psess 83 | *.vsp 84 | *.vspx 85 | 86 | # TFS 2012 Local Workspace 87 | $tf/ 88 | 89 | # Guidance Automation Toolkit 90 | *.gpState 91 | 92 | # ReSharper is a .NET coding add-in 93 | _ReSharper*/ 94 | *.[Rr]e[Ss]harper 95 | *.DotSettings.user 96 | 97 | # JustCode is a .NET coding add-in 98 | .JustCode 99 | 100 | # TeamCity is a build add-in 101 | _TeamCity* 102 | 103 | # DotCover is a Code Coverage Tool 104 | *.dotCover 105 | 106 | # NCrunch 107 | _NCrunch_* 108 | .*crunch*.local.xml 109 | 110 | # MightyMoose 111 | *.mm.* 112 | AutoTest.Net/ 113 | 114 | # Web workbench (sass) 115 | .sass-cache/ 116 | 117 | # Installshield output folder 118 | [Ee]xpress/ 119 | 120 | # DocProject is a documentation generator add-in 121 | DocProject/buildhelp/ 122 | DocProject/Help/*.HxT 123 | DocProject/Help/*.HxC 124 | DocProject/Help/*.hhc 125 | DocProject/Help/*.hhk 126 | DocProject/Help/*.hhp 127 | DocProject/Help/Html2 128 | DocProject/Help/html 129 | 130 | # Click-Once directory 131 | publish/ 132 | 133 | # Publish Web Output 134 | *.[Pp]ublish.xml 135 | *.azurePubxml 136 | ## TODO: Comment the next line if you want to checkin your 137 | ## web deploy settings but do note that will include unencrypted 138 | ## passwords 139 | #*.pubxml 140 | 141 | *.publishproj 142 | 143 | # NuGet Packages 144 | *.nupkg 145 | # The packages folder can be ignored because of Package Restore 146 | **/packages/* 147 | # except build/, which is used as an MSBuild target. 148 | !**/packages/build/ 149 | # Uncomment if necessary however generally it will be regenerated when needed 150 | #!**/packages/repositories.config 151 | 152 | # Windows Azure Build Output 153 | csx/ 154 | *.build.csdef 155 | 156 | # Windows Store app package directory 157 | AppPackages/ 158 | 159 | # Visual Studio cache files 160 | # files ending in .cache can be ignored 161 | *.[Cc]ache 162 | # but keep track of directories ending in .cache 163 | !*.[Cc]ache/ 164 | 165 | # Others 166 | ClientBin/ 167 | [Ss]tyle[Cc]op.* 168 | ~$* 169 | *~ 170 | *.dbmdl 171 | *.dbproj.schemaview 172 | *.pfx 173 | *.publishsettings 174 | node_modules/ 175 | orleans.codegen.cs 176 | 177 | # RIA/Silverlight projects 178 | Generated_Code/ 179 | 180 | # Backup & report files from converting an old project file 181 | # to a newer Visual Studio version. Backup files are not needed, 182 | # because we have git ;-) 183 | _UpgradeReport_Files/ 184 | Backup*/ 185 | UpgradeLog*.XML 186 | UpgradeLog*.htm 187 | 188 | # SQL Server files 189 | *.mdf 190 | *.ldf 191 | 192 | # Business Intelligence projects 193 | *.rdl.data 194 | *.bim.layout 195 | *.bim_*.settings 196 | 197 | # Microsoft Fakes 198 | FakesAssemblies/ 199 | 200 | # Node.js Tools for Visual Studio 201 | .ntvs_analysis.dat 202 | 203 | # Visual Studio 6 build log 204 | *.plg 205 | 206 | # Visual Studio 6 workspace options file 207 | *.opt 208 | 209 | # LightSwitch generated files 210 | GeneratedArtifacts/ 211 | _Pvt_Extensions/ 212 | ModelManifest.xml 213 | -------------------------------------------------------------------------------- /365-Project-Online-OM-ProjToolV2/365-Project-Online-OM-ProjToolV2.sample.yml: -------------------------------------------------------------------------------- 1 | ### YamlMime:Sample 2 | sample: 3 | - name: 'Project add-in: Project Online CSOM Tool (ProjToolV2)' 4 | path: 365-Project-Online-OM-ProjToolV2 5 | description: This UI tool performs basic data manipulation on a Project Online instance. It uses CSOM queries to create, read, update, or delete project server data. 6 | readme: '' 7 | generateZip: FALSE 8 | isLive: TRUE 9 | technologies: 10 | - Office Add-in 11 | azureDeploy: '' 12 | author: RobertMurugan 13 | platforms: [] 14 | languages: 15 | - C# 16 | extensions: 17 | products: 18 | - Project 19 | - Office 365 20 | scenarios: [] 21 | -------------------------------------------------------------------------------- /365-Project-Online-OM-ProjToolV2/LICENSE: -------------------------------------------------------------------------------- 1 | ProjToolV2 2 | 3 | The MIT License (MIT) 4 | 5 | Copyright (c) 2016 Microsoft Corporation 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. -------------------------------------------------------------------------------- /365-Project-Online-OM-ProjToolV2/ProjToolV2/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 |
8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | False 27 | 28 | 29 | True 30 | 31 | 32 | False 33 | 34 | 35 | Critical 36 | 37 | 38 | True 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | False 53 | 54 | 55 | True 56 | 57 | 58 | False 59 | 60 | 61 | False 62 | 63 | 64 | Critical 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /365-Project-Online-OM-ProjToolV2/ProjToolV2/AppSettings.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. 3 | * See LICENSE in the project root for license information. 4 | */ 5 | 6 | using ProjToolV2.Properties; 7 | using System; 8 | using System.Diagnostics; 9 | using System.IO; 10 | using System.Windows.Forms; 11 | 12 | namespace ProjToolV2 13 | { 14 | public partial class AppSettings : BaseForm 15 | { 16 | public AppSettings() 17 | { 18 | InitializeComponent(); 19 | Icon = Resources.Project; 20 | } 21 | 22 | private void Settings_Load(object sender, EventArgs e) 23 | { 24 | LB_LogLevel.DataSource = Enum.GetNames(typeof(SourceLevels)); 25 | LB_LogLevel.SelectedItem = Settings.Default.SourceLevel.ToString(); 26 | LB_LogLevel.SelectedIndexChanged += LB_LogLevel_SelectedIndexChanged; 27 | CB_WaitForQueue.Checked = Settings.Default.WaitForQueue; 28 | CB_LoadAllProperties.Checked = Settings.Default.LoadAllProperties; 29 | 30 | LL_LogFolderLocation.Text = Path.GetDirectoryName(Log.FilePath); 31 | LL_LogFolderLocation.LinkClicked += LL_LogFolderLocation_LinkClicked; 32 | if (File.Exists(Log.FilePath)) 33 | { 34 | LL_LogFileLocation.Text = Log.FilePath; 35 | LL_LogFileLocation.LinkClicked += LL_LogFileLocation_LinkClicked; 36 | } 37 | else 38 | { 39 | LL_LogFileLocation.Text = "Log File does not Exist"; 40 | } 41 | } 42 | 43 | private static void LL_LogFileLocation_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) 44 | { 45 | if (File.Exists(Log.FilePath)) 46 | { 47 | Process.Start(Log.FilePath); 48 | } 49 | } 50 | 51 | private static void LL_LogFolderLocation_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) 52 | { 53 | Process.Start(Path.GetDirectoryName(Log.FilePath)); 54 | } 55 | 56 | private void CB_WaitForQueue_CheckedChanged(object sender, EventArgs e) 57 | { 58 | Settings.Default.WaitForQueue = CB_WaitForQueue.Checked; 59 | Settings.Default.Save(); 60 | } 61 | 62 | private void CB_LoadAllProperties_CheckedChanged(object sender, EventArgs e) 63 | { 64 | Settings.Default.LoadAllProperties = CB_LoadAllProperties.Checked; 65 | Settings.Default.Save(); 66 | } 67 | 68 | private void LB_LogLevel_SelectedIndexChanged(object sender, EventArgs e) 69 | { 70 | Settings.Default.SourceLevel = (SourceLevels)Enum.Parse(typeof(SourceLevels), LB_LogLevel.SelectedValue.ToString()); 71 | Log.TraceSource.Switch.Level = Settings.Default.SourceLevel; 72 | Settings.Default.Save(); 73 | } 74 | } 75 | } -------------------------------------------------------------------------------- /365-Project-Online-OM-ProjToolV2/ProjToolV2/AppSettings.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /365-Project-Online-OM-ProjToolV2/ProjToolV2/Creation/CustomFieldsCreation.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. 3 | * See LICENSE in the project root for license information. 4 | */ 5 | 6 | using Microsoft.ProjectServer.Client; 7 | using ProjToolV2.Properties; 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Windows.Forms; 11 | 12 | namespace ProjToolV2 13 | { 14 | public partial class CustomFieldsCreation : BaseForm 15 | { 16 | private BackgroundExecutorWithStatus _backgroundExecutorWithStatus; 17 | 18 | public CustomFieldsCreation() 19 | { 20 | InitializeComponent(); 21 | Icon = Resources.Project; 22 | } 23 | 24 | private void CustomFieldsCreation_Load(object sender, EventArgs e) 25 | { 26 | CB_Type.DataSource = Enum.GetValues(typeof(CustomFieldType)); 27 | CB_Type.SelectedItem = CustomFieldType.TEXT; 28 | 29 | Dictionary entityType = new Dictionary 30 | { 31 | {"Task", ProjContext.EntityTypes.TaskEntity}, 32 | {"Resource", ProjContext.EntityTypes.ResourceEntity}, 33 | {"Project", ProjContext.EntityTypes.ProjectEntity} 34 | }; 35 | CB_EntityType.DataSource = new BindingSource(entityType, null); 36 | CB_EntityType.DisplayMember = "Key"; 37 | CB_EntityType.ValueMember = "Value"; 38 | CB_EntityType.SelectedIndex = 2; 39 | 40 | _backgroundExecutorWithStatus = new BackgroundExecutorWithStatus(TB_Status, "Loading LookupTables"); 41 | _backgroundExecutorWithStatus.ExecuteWorker(LoadLookupTables); 42 | } 43 | 44 | private void LoadLookupTables() 45 | { 46 | IEnumerable lookupTables1 = ProjContext.LoadQuery(ProjContext.LookupTables); 47 | ProjContext.ExecuteQuery(); 48 | Dictionary lookupTables = new Dictionary { { "Select", null } }; 49 | foreach (LookupTable lt in lookupTables1) 50 | { 51 | lookupTables.Add(lt.Name, lt); 52 | } 53 | CB_LookupTable.InvokeIfRequired(cb => 54 | { 55 | cb.DataSource = new BindingSource(lookupTables, null); 56 | cb.DisplayMember = "Key"; 57 | cb.ValueMember = "Value"; 58 | }); 59 | } 60 | 61 | private void BTN_Create_Click(object sender, EventArgs e) 62 | { 63 | BackgroundExecutorWithStatus bews = new BackgroundExecutorWithStatus(TB_Status, "Creating CustomFields"); 64 | bews.ExecuteWorker(CreateCustomFields); 65 | } 66 | 67 | private void CreateCustomFields() 68 | { 69 | EntityType entityType = ProjContext.EntityTypes.ProjectEntity; 70 | CustomFieldType customFieldType = CustomFieldType.TEXT; 71 | LookupTable selectedLookupTable = null; 72 | bool allowMultiSelect = false; 73 | 74 | CB_EntityType.InvokeIfRequired(cb => entityType = cb.SelectedValue as EntityType); 75 | CB_Type.InvokeIfRequired(sb => customFieldType = (CustomFieldType)CB_Type.SelectedValue); 76 | CB_LookupTable.InvokeIfRequired(cb => 77 | { 78 | if (cb.SelectedIndex <= 0) return; 79 | selectedLookupTable = cb.SelectedValue as LookupTable; 80 | if (CBX_AllowMultiSelect.Checked) 81 | allowMultiSelect = true; 82 | }); 83 | for (int customFieldCount = 1; customFieldCount <= Convert.ToInt32(NUD_CFNumber.Value); customFieldCount++) 84 | { 85 | CustomFieldCreationInformation cfCi = new CustomFieldCreationInformation 86 | { 87 | Name = TB_Name.Text + customFieldCount, 88 | EntityType = entityType, 89 | FieldType = customFieldType 90 | }; 91 | Log.WriteVerbose(new SourceInfo(), TB_Status, "Creating custom field with name {0}", cfCi.Name); 92 | if (selectedLookupTable != null) 93 | { 94 | cfCi.LookupTable = selectedLookupTable; 95 | Log.WriteVerbose(new SourceInfo(), TB_Status, "Setting custom field to use lookup table {0}", selectedLookupTable.Name); 96 | } 97 | 98 | cfCi.LookupAllowMultiSelect = allowMultiSelect; 99 | ProjContext.CustomFields.Add(cfCi); 100 | } 101 | ProjContext.CustomFields.Update(); 102 | ProjContext.ExecuteQuery(); 103 | } 104 | 105 | private void BTN_Back_Click(object sender, EventArgs e) 106 | { 107 | _backgroundExecutorWithStatus?.Cancel(); 108 | } 109 | 110 | private void BTN_Cancel_Click(object sender, EventArgs e) 111 | { 112 | Visible = false; 113 | } 114 | } 115 | } -------------------------------------------------------------------------------- /365-Project-Online-OM-ProjToolV2/ProjToolV2/Creation/LookupTablesCreation.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. 3 | * See LICENSE in the project root for license information. 4 | */ 5 | 6 | using Microsoft.ProjectServer.Client; 7 | using ProjToolV2.Properties; 8 | using System; 9 | using System.Collections.Generic; 10 | 11 | namespace ProjToolV2 12 | { 13 | public partial class LookupTablesCreation : BaseForm 14 | { 15 | private BackgroundExecutorWithStatus _backgroundExecutorWithStatus; 16 | 17 | public LookupTablesCreation() 18 | { 19 | InitializeComponent(); 20 | Icon = Resources.Project; 21 | } 22 | 23 | private void LookupTablesCreation_Load(object sender, EventArgs e) 24 | { 25 | CB_Sort.DataSource = Enum.GetValues(typeof(LookupTableSortOrder)); 26 | CB_Sort.SelectedItem = LookupTableSortOrder.Ascending; 27 | } 28 | 29 | private void BTN_Create_Click(object sender, EventArgs e) 30 | { 31 | _backgroundExecutorWithStatus = new BackgroundExecutorWithStatus(TB_Status, "Creating Text LookupTables"); 32 | _backgroundExecutorWithStatus.ExecuteWorker(CreateLookupTables); 33 | } 34 | 35 | private void CreateLookupTables() 36 | { 37 | for (int lookupTableCount = 1; lookupTableCount <= Convert.ToInt32(NUD_LTNumber.Value); lookupTableCount++) 38 | { 39 | List masks = new List(); 40 | for (int levelCount = 0; levelCount <= Convert.ToInt32(NUD_Levels.Value); levelCount++) 41 | { 42 | LookupMask lkm = new LookupMask 43 | { 44 | Length = 0, 45 | MaskType = LookupTableMaskSequence.CHARACTERS, 46 | Separator = "." 47 | }; 48 | masks.Add(lkm); 49 | } 50 | 51 | List lookupEntry = new List(); 52 | for (int levelCount = 1; levelCount <= Convert.ToInt32(NUD_Levels.Value); levelCount++) 53 | { 54 | //creating the parent level 55 | LookupEntryCreationInformation parentCi = new LookupEntryCreationInformation 56 | { 57 | Id = Guid.NewGuid(), 58 | SortIndex = 0, 59 | Value = 60 | new LookupEntryValue { TextValue = RandomEx.RandomString(Convert.ToInt32(NUD_Length.Value)) } 61 | }; 62 | lookupEntry.Add(parentCi); 63 | 64 | //creating the child levels 65 | for (int subLevel = 1; subLevel <= Convert.ToInt32(NUD_ValuePerLevel.Value); subLevel++) 66 | { 67 | LookupEntryCreationInformation childCi = new LookupEntryCreationInformation 68 | { 69 | Id = Guid.NewGuid(), 70 | ParentId = parentCi.Id, 71 | SortIndex = 0, 72 | Value = 73 | new LookupEntryValue 74 | { 75 | TextValue = RandomEx.RandomString(Convert.ToInt32(NUD_Length.Value)) 76 | } 77 | }; 78 | lookupEntry.Add(childCi); 79 | } 80 | } 81 | 82 | LookupTableSortOrder lookupTableSortOrder = LookupTableSortOrder.Ascending; 83 | CB_Sort.InvokeIfRequired(cb => lookupTableSortOrder = (LookupTableSortOrder)cb.SelectedValue); 84 | 85 | LookupTableCreationInformation ltCi = new LookupTableCreationInformation 86 | { 87 | Name = TB_Name.Text + lookupTableCount, 88 | Masks = masks, 89 | SortOrder = lookupTableSortOrder, 90 | Entries = lookupEntry 91 | }; 92 | Log.WriteVerbose(new SourceInfo(), TB_Status, "Creating lookup field with name {0}", ltCi.Name); 93 | ProjContext.LookupTables.Add(ltCi); 94 | } 95 | ProjContext.LookupTables.Update(); 96 | ProjContext.ExecuteQuery(); 97 | } 98 | 99 | private void BTN_Cancel_Click(object sender, EventArgs e) 100 | { 101 | _backgroundExecutorWithStatus?.Cancel(); 102 | } 103 | 104 | private void BTN_Back_Click(object sender, EventArgs e) 105 | { 106 | Visible = false; 107 | } 108 | } 109 | } -------------------------------------------------------------------------------- /365-Project-Online-OM-ProjToolV2/ProjToolV2/Creation/ProjectsCreation.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /365-Project-Online-OM-ProjToolV2/ProjToolV2/Creation/ResourcesCreation.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. 3 | * See LICENSE in the project root for license information. 4 | */ 5 | 6 | using Microsoft.ProjectServer.Client; 7 | using ProjToolV2.Properties; 8 | using System; 9 | 10 | namespace ProjToolV2 11 | { 12 | public partial class ResourcesCreation : BaseForm 13 | { 14 | private BackgroundExecutorWithStatus _backgroundExecutorWithStatus; 15 | 16 | public ResourcesCreation() 17 | { 18 | InitializeComponent(); 19 | Icon = Resources.Project; 20 | } 21 | 22 | private void BTN_Create_Click(object sender, EventArgs e) 23 | { 24 | _backgroundExecutorWithStatus = new BackgroundExecutorWithStatus(TB_Status, "Creating Enterprise Resources"); 25 | _backgroundExecutorWithStatus.ExecuteWorker(CreateResources); 26 | } 27 | 28 | private void CreateResources() 29 | { 30 | EnterpriseResourceType selectedEnterpriseResourceType = EnterpriseResourceType.Work; 31 | cbxResType.InvokeIfRequired(s => selectedEnterpriseResourceType = (EnterpriseResourceType)cbxResType.SelectedValue); 32 | for (int resourceCount = 1; resourceCount <= numResources.Value; resourceCount++) 33 | { 34 | EnterpriseResourceCreationInformation erCi = new EnterpriseResourceCreationInformation 35 | { 36 | Name = txtResourceName.Text + resourceCount, 37 | IsInactive = CB_Inactive.Checked, 38 | IsGeneric = CB_Generic.Checked, 39 | IsBudget = CB_Budget.Checked, 40 | ResourceType = selectedEnterpriseResourceType 41 | }; 42 | Log.WriteVerbose(new SourceInfo(), TB_Status, "Creating Resource with name {0}", erCi.Name); 43 | ProjContext.EnterpriseResources.Add(erCi); 44 | } 45 | ProjContext.EnterpriseResources.Update(); 46 | ProjContext.ExecuteQuery(); 47 | } 48 | 49 | private void ResourcesCreation_Load(object sender, EventArgs e) 50 | { 51 | cbxResType.DataSource = Enum.GetValues(typeof(EnterpriseResourceType)); 52 | cbxResType.SelectedItem = EnterpriseResourceType.Work; 53 | } 54 | 55 | private void BTN_Back_Click(object sender, EventArgs e) 56 | { 57 | Visible = false; 58 | } 59 | 60 | private void BTN_Cancel_Click(object sender, EventArgs e) 61 | { 62 | _backgroundExecutorWithStatus?.Cancel(); 63 | } 64 | } 65 | } -------------------------------------------------------------------------------- /365-Project-Online-OM-ProjToolV2/ProjToolV2/Creation/ResourcesCreation.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /365-Project-Online-OM-ProjToolV2/ProjToolV2/Images/Project.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Project-Samples/7d131365acf017a07534bb69f3ae050dd4e4766e/365-Project-Online-OM-ProjToolV2/ProjToolV2/Images/Project.ico -------------------------------------------------------------------------------- /365-Project-Online-OM-ProjToolV2/ProjToolV2/Images/Project.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Project-Samples/7d131365acf017a07534bb69f3ae050dd4e4766e/365-Project-Online-OM-ProjToolV2/ProjToolV2/Images/Project.png -------------------------------------------------------------------------------- /365-Project-Online-OM-ProjToolV2/ProjToolV2/Images/Project.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Project-Samples/7d131365acf017a07534bb69f3ae050dd4e4766e/365-Project-Online-OM-ProjToolV2/ProjToolV2/Images/Project.xcf -------------------------------------------------------------------------------- /365-Project-Online-OM-ProjToolV2/ProjToolV2/Images/logs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Project-Samples/7d131365acf017a07534bb69f3ae050dd4e4766e/365-Project-Online-OM-ProjToolV2/ProjToolV2/Images/logs.png -------------------------------------------------------------------------------- /365-Project-Online-OM-ProjToolV2/ProjToolV2/Images/popout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Project-Samples/7d131365acf017a07534bb69f3ae050dd4e4766e/365-Project-Online-OM-ProjToolV2/ProjToolV2/Images/popout.png -------------------------------------------------------------------------------- /365-Project-Online-OM-ProjToolV2/ProjToolV2/Images/refresh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Project-Samples/7d131365acf017a07534bb69f3ae050dd4e4766e/365-Project-Online-OM-ProjToolV2/ProjToolV2/Images/refresh.png -------------------------------------------------------------------------------- /365-Project-Online-OM-ProjToolV2/ProjToolV2/Images/settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Project-Samples/7d131365acf017a07534bb69f3ae050dd4e4766e/365-Project-Online-OM-ProjToolV2/ProjToolV2/Images/settings.png -------------------------------------------------------------------------------- /365-Project-Online-OM-ProjToolV2/ProjToolV2/LoginPage.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. 3 | * See LICENSE in the project root for license information. 4 | */ 5 | 6 | using Microsoft.ProjectServer.Client; 7 | using Microsoft.SharePoint.Client; 8 | using ProjToolV2.Properties; 9 | using System; 10 | using System.Diagnostics; 11 | using System.Drawing; 12 | using System.Net; 13 | using System.Security; 14 | using System.Windows.Forms; 15 | using Resources = ProjToolV2.Properties.Resources; 16 | 17 | namespace ProjToolV2 18 | { 19 | public partial class LoginPage : BaseForm 20 | { 21 | private BackgroundExecutorWithStatus _bge; 22 | 23 | public LoginPage() 24 | { 25 | Icon = Resources.Project; 26 | InitializeComponent(); 27 | FormBorderStyle = FormBorderStyle.None; 28 | } 29 | 30 | private void Btn_Login_Click(object sender, EventArgs e) 31 | { 32 | Settings.Default.Url = TB_Url.Text; 33 | Settings.Default.UserName = TB_UserName.Text; 34 | Settings.Default.WindowsAuthenticationMode = RB_Windows.Checked; 35 | Settings.Default.ProjectOnLine = CB_Online.Checked; 36 | Settings.Default.Save(); 37 | 38 | _bge = new BackgroundExecutorWithStatus(LBL_Status, "Authenticating"); 39 | _bge.ExecuteWorker(LoginProjectServer); 40 | } 41 | 42 | private void LoginProjectServer() 43 | { 44 | Log.WriteVerbose(new SourceInfo(), "Logging into project server on url:{0}", TB_Url.Text); 45 | ProjContext = new ProjectContext(TB_Url.Text); 46 | Log.WriteVerbose(new SourceInfo(), "Authenticating against {0} pwa instance", CB_Online.Checked ? "Online" : "OnPerm"); 47 | 48 | if (CB_Online.Checked && RB_Forms.Checked) 49 | { 50 | //case online with user credential 51 | SecureString secpassword = new SecureString(); 52 | foreach (char c in TB_Password.Text) secpassword.AppendChar(c); 53 | ProjContext.Credentials = new SharePointOnlineCredentials(TB_UserName.Text, secpassword); 54 | } 55 | else if (!CB_Online.Checked && RB_Forms.Checked) 56 | { 57 | //case onprem with user credential 58 | ProjContext.AuthenticationMode = ClientAuthenticationMode.FormsAuthentication; 59 | FormsAuthenticationLoginInfo formsAuthInfo = new FormsAuthenticationLoginInfo(TB_UserName.Text, TB_Password.Text); 60 | ProjContext.FormsAuthenticationLoginInfo = formsAuthInfo; 61 | } 62 | else 63 | { 64 | //Default case - Windows Auth 65 | ProjContext.Credentials = CredentialCache.DefaultCredentials; 66 | } 67 | CsomHelper.ProjContext = ProjContext; 68 | CsomBase.CurrentResource = CsomHelper.LoadMe(); 69 | CsomBase.CurrentUser = CsomBase.CurrentResource.User; 70 | if (_bge.TaskCancelled || _bge.ActionTask.IsFaulted) 71 | { 72 | return; 73 | } 74 | Log.WriteVerbose(new SourceInfo(), "Login on url:{0} for user:{1}", TB_Url.Text, CsomBase.CurrentUser.Title); 75 | DialogResult = DialogResult.OK; 76 | } 77 | 78 | private void BTN_Exit_Click(object sender, EventArgs e) 79 | { 80 | Close(); 81 | } 82 | 83 | private void LoginPage_Load(object sender, EventArgs e) 84 | { 85 | Log.WriteVerbose(new SourceInfo(), "Loading Login form..."); 86 | if (Settings.Default.Url == string.Empty) 87 | { 88 | Log.WriteVerbose(new SourceInfo(), "No server url found from saved settings. Setting the server url to be local server."); 89 | TB_Url.Text = "http://" + Environment.MachineName + "/pwa"; 90 | } 91 | else 92 | { 93 | Log.WriteVerbose(new SourceInfo(), "Loading server url from saved settings."); 94 | TB_Url.Text = Settings.Default.Url; 95 | } 96 | CB_Online.Checked = Settings.Default.ProjectOnLine; 97 | RB_Windows.Checked = Settings.Default.WindowsAuthenticationMode; 98 | RB_Forms.Checked = !Settings.Default.WindowsAuthenticationMode; 99 | } 100 | 101 | private void LoginPage_Resize(object sender, EventArgs e) 102 | { 103 | Invalidate(); 104 | } 105 | 106 | private void BTN_Cancel_Click(object sender, EventArgs e) 107 | { 108 | _bge?.Cancel(); 109 | } 110 | 111 | private void RB_Forms_CheckedChanged(object sender, EventArgs e) 112 | { 113 | TB_UserName.Enabled = RB_Forms.Checked; 114 | TB_Password.Enabled = RB_Forms.Checked; 115 | } 116 | 117 | private bool _mouseDown; 118 | private Point _lastLocation; 119 | 120 | private void LBL_Title_MouseDown(object sender, MouseEventArgs e) 121 | { 122 | _mouseDown = true; 123 | _lastLocation = e.Location; 124 | } 125 | 126 | private void LBL_Title_MouseMove(object sender, MouseEventArgs e) 127 | { 128 | if (!_mouseDown) return; 129 | Location = new Point( 130 | Location.X - _lastLocation.X + e.X, Location.Y - _lastLocation.Y + e.Y); 131 | 132 | Update(); 133 | } 134 | 135 | private void LBL_Title_MouseUp(object sender, MouseEventArgs e) 136 | { 137 | _mouseDown = false; 138 | } 139 | 140 | private void RB_Windows_CheckedChanged(object sender, EventArgs e) 141 | { 142 | TB_UserName.Enabled = RB_Forms.Checked; 143 | TB_Password.Enabled = RB_Forms.Checked; 144 | } 145 | } 146 | } -------------------------------------------------------------------------------- /365-Project-Online-OM-ProjToolV2/ProjToolV2/Manage/CheckInCheckOut.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /365-Project-Online-OM-ProjToolV2/ProjToolV2/Manage/ProjectsPublish.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /365-Project-Online-OM-ProjToolV2/ProjToolV2/Manage/ServerObjectsDelete.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /365-Project-Online-OM-ProjToolV2/ProjToolV2/ProjToolV2.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.23107.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProjToolV2", "ProjToolV2.csproj", "{209DA642-21FB-4FFC-9FF6-6E8E5AC3155E}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {209DA642-21FB-4FFC-9FF6-6E8E5AC3155E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {209DA642-21FB-4FFC-9FF6-6E8E5AC3155E}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {209DA642-21FB-4FFC-9FF6-6E8E5AC3155E}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {209DA642-21FB-4FFC-9FF6-6E8E5AC3155E}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /365-Project-Online-OM-ProjToolV2/ProjToolV2/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. 3 | * See LICENSE in the project root for license information. 4 | */ 5 | 6 | using System.Reflection; 7 | using System.Runtime.InteropServices; 8 | 9 | // General Information about an assembly is controlled through the following 10 | // set of attributes. Change these attribute values to modify the information 11 | // associated with an assembly. 12 | [assembly: AssemblyTitle("ProjToolV2")] 13 | [assembly: AssemblyDescription("")] 14 | [assembly: AssemblyConfiguration("")] 15 | [assembly: AssemblyCompany("Microsoft.com")] 16 | [assembly: AssemblyProduct("ProjToolV2")] 17 | [assembly: AssemblyCopyright("Copyright © 2016")] 18 | [assembly: AssemblyTrademark("")] 19 | [assembly: AssemblyCulture("")] 20 | 21 | // Setting ComVisible to false makes the types in this assembly not visible 22 | // to COM components. If you need to access a type in this assembly from 23 | // COM, set the ComVisible attribute to true on that type. 24 | [assembly: ComVisible(false)] 25 | 26 | // The following GUID is for the ID of the typelib if this project is exposed to COM 27 | [assembly: Guid("6ea7c946-2ceb-458e-9863-a020e5d693f2")] 28 | 29 | // Version information for an assembly consists of the following four values: 30 | // 31 | // Major Version 32 | // Minor Version 33 | // Build Number 34 | // Revision 35 | // 36 | // You can specify all the values or you can default the Build and Revision Numbers 37 | // by using the '*' as shown below: 38 | // [assembly: AssemblyVersion("1.0.*")] 39 | [assembly: AssemblyVersion("1.0.0.0")] 40 | [assembly: AssemblyFileVersion("1.0.0.0")] -------------------------------------------------------------------------------- /365-Project-Online-OM-ProjToolV2/ProjToolV2/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace ProjToolV2.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | public class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | public static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ProjToolV2.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | public static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | 63 | /// 64 | /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon). 65 | /// 66 | public static System.Drawing.Icon Project { 67 | get { 68 | object obj = ResourceManager.GetObject("Project", resourceCulture); 69 | return ((System.Drawing.Icon)(obj)); 70 | } 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /365-Project-Online-OM-ProjToolV2/ProjToolV2/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace ProjToolV2.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")] 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 18 | 19 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 20 | 21 | public static Settings Default { 22 | get { 23 | return defaultInstance; 24 | } 25 | } 26 | 27 | [global::System.Configuration.UserScopedSettingAttribute()] 28 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 29 | [global::System.Configuration.DefaultSettingValueAttribute("")] 30 | public string Setting { 31 | get { 32 | return ((string)(this["Setting"])); 33 | } 34 | set { 35 | this["Setting"] = value; 36 | } 37 | } 38 | 39 | [global::System.Configuration.UserScopedSettingAttribute()] 40 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 41 | [global::System.Configuration.DefaultSettingValueAttribute("")] 42 | public string Url { 43 | get { 44 | return ((string)(this["Url"])); 45 | } 46 | set { 47 | this["Url"] = value; 48 | } 49 | } 50 | 51 | [global::System.Configuration.UserScopedSettingAttribute()] 52 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 53 | [global::System.Configuration.DefaultSettingValueAttribute("")] 54 | public string UserName { 55 | get { 56 | return ((string)(this["UserName"])); 57 | } 58 | set { 59 | this["UserName"] = value; 60 | } 61 | } 62 | 63 | [global::System.Configuration.UserScopedSettingAttribute()] 64 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 65 | [global::System.Configuration.DefaultSettingValueAttribute("False")] 66 | public bool ProjectOnLine { 67 | get { 68 | return ((bool)(this["ProjectOnLine"])); 69 | } 70 | set { 71 | this["ProjectOnLine"] = value; 72 | } 73 | } 74 | 75 | [global::System.Configuration.UserScopedSettingAttribute()] 76 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 77 | [global::System.Configuration.DefaultSettingValueAttribute("True")] 78 | public bool WaitForQueue { 79 | get { 80 | return ((bool)(this["WaitForQueue"])); 81 | } 82 | set { 83 | this["WaitForQueue"] = value; 84 | } 85 | } 86 | 87 | [global::System.Configuration.UserScopedSettingAttribute()] 88 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 89 | [global::System.Configuration.DefaultSettingValueAttribute("False")] 90 | public bool LoadAllProperties { 91 | get { 92 | return ((bool)(this["LoadAllProperties"])); 93 | } 94 | set { 95 | this["LoadAllProperties"] = value; 96 | } 97 | } 98 | 99 | [global::System.Configuration.UserScopedSettingAttribute()] 100 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 101 | [global::System.Configuration.DefaultSettingValueAttribute("Critical")] 102 | public global::System.Diagnostics.SourceLevels SourceLevel { 103 | get { 104 | return ((global::System.Diagnostics.SourceLevels)(this["SourceLevel"])); 105 | } 106 | set { 107 | this["SourceLevel"] = value; 108 | } 109 | } 110 | 111 | [global::System.Configuration.UserScopedSettingAttribute()] 112 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 113 | [global::System.Configuration.DefaultSettingValueAttribute("True")] 114 | public bool WindowsAuthenticationMode { 115 | get { 116 | return ((bool)(this["WindowsAuthenticationMode"])); 117 | } 118 | set { 119 | this["WindowsAuthenticationMode"] = value; 120 | } 121 | } 122 | } 123 | } 124 | -------------------------------------------------------------------------------- /365-Project-Online-OM-ProjToolV2/ProjToolV2/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | False 16 | 17 | 18 | True 19 | 20 | 21 | False 22 | 23 | 24 | Critical 25 | 26 | 27 | True 28 | 29 | 30 | -------------------------------------------------------------------------------- /365-Project-Online-OM-ProjToolV2/ProjToolV2/Utilities/BackgroundWorkerBase.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. 3 | * See LICENSE in the project root for license information. 4 | */ 5 | 6 | using System.ComponentModel; 7 | using System.Threading; 8 | 9 | namespace ProjToolV2 10 | { 11 | public class BackgroundExecutorBase : BackgroundWorker 12 | { 13 | private Thread _workerThread; 14 | 15 | public BackgroundExecutorBase() 16 | { 17 | WorkerReportsProgress = true; 18 | } 19 | 20 | protected override void OnDoWork(DoWorkEventArgs e) 21 | { 22 | _workerThread = Thread.CurrentThread; 23 | try 24 | { 25 | base.OnDoWork(e); 26 | } 27 | catch (ThreadAbortException) 28 | { 29 | e.Cancel = true; 30 | Thread.ResetAbort(); 31 | } 32 | } 33 | 34 | public void Abort() 35 | { 36 | if (_workerThread == null) return; 37 | _workerThread.Abort(); 38 | _workerThread = null; 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /365-Project-Online-OM-ProjToolV2/ProjToolV2/Utilities/BaseForm.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. 3 | * See LICENSE in the project root for license information. 4 | */ 5 | 6 | using Microsoft.ProjectServer.Client; 7 | using System; 8 | using System.Windows.Forms; 9 | using Task = System.Threading.Tasks.Task; 10 | 11 | namespace ProjToolV2 12 | { 13 | public class BaseForm : Form 14 | { 15 | internal static ProjectContext ProjContext { get; set; } 16 | 17 | public enum ServerObjectType 18 | { 19 | Project, 20 | Resource, 21 | Calendar, 22 | CustomField, 23 | LookupTable 24 | } 25 | 26 | public BaseForm() 27 | { 28 | Opacity = 0; 29 | } 30 | 31 | protected override void OnVisibleChanged(EventArgs e) 32 | { 33 | if (Visible) 34 | { 35 | FadeIn(); 36 | } 37 | else 38 | { 39 | FadeOut(); 40 | } 41 | base.OnVisibleChanged(e); 42 | } 43 | 44 | private async void FadeIn(int interval = 50) 45 | { 46 | while (Opacity < 1.0) 47 | { 48 | await Task.Delay(interval); 49 | Opacity += 0.05; 50 | } 51 | Opacity = 1; 52 | } 53 | 54 | private async void FadeOut(int interval = 50) 55 | { 56 | while (Opacity > 0.0) 57 | { 58 | await Task.Delay(interval); 59 | Opacity -= 0.05; 60 | } 61 | Opacity = 0; 62 | } 63 | } 64 | } -------------------------------------------------------------------------------- /365-Project-Online-OM-ProjToolV2/ProjToolV2/Utilities/BaseForm.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /365-Project-Online-OM-ProjToolV2/ProjToolV2/Utilities/CsomBase.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. 3 | * See LICENSE in the project root for license information. 4 | */ 5 | 6 | using Microsoft.ProjectServer.Client; 7 | using Microsoft.SharePoint.Client; 8 | 9 | namespace ProjToolV2 10 | { 11 | /// 12 | /// Static class to cache some of the client object values 13 | /// 14 | internal static class CsomBase 15 | { 16 | private static EnterpriseResource _currentResource; 17 | private static bool _currentResourceIsAssignable; 18 | 19 | public static EnterpriseResource CurrentResource 20 | { 21 | get { return _currentResource ?? (_currentResource = CsomHelper.LoadMe()); } 22 | set 23 | { 24 | _currentResource = value; 25 | } 26 | } 27 | 28 | public static User CurrentUser { get; set; } 29 | 30 | public static bool CurrentResourceIsAssignable 31 | { 32 | get 33 | { 34 | //If the current resource is not of type work, we dont cache the value. 35 | if (!_currentResourceIsAssignable) 36 | { 37 | _currentResourceIsAssignable = CsomHelper.CheckCurrentResourceIsAssignable(); 38 | } 39 | return _currentResourceIsAssignable; 40 | } 41 | set 42 | { 43 | _currentResourceIsAssignable = value; 44 | } 45 | } 46 | 47 | public static void ClearCsomObjects() 48 | { 49 | Log.WriteVerbose(new SourceInfo(), "Clearing all csom related static objects."); 50 | CsomHelper.ProjContext = null; 51 | CurrentUser = null; 52 | _currentResource = null; 53 | _currentResourceIsAssignable = false; 54 | } 55 | } 56 | } -------------------------------------------------------------------------------- /365-Project-Online-OM-ProjToolV2/ProjToolV2/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /365-Project-Online-OM-ProjToolV2/ProjToolV2/project.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Project-Samples/7d131365acf017a07534bb69f3ae050dd4e4766e/365-Project-Online-OM-ProjToolV2/ProjToolV2/project.ico -------------------------------------------------------------------------------- /365-Project-Online-OM-ProjToolV2/readme.md: -------------------------------------------------------------------------------- 1 | # Project CSOM Tool (ProjToolV2) 2 | This Project Online tool demonstrates how to use project server CSOM methods. It uses CSOM queries to create, read, update, or delete project server data. 3 | 4 | ## Prerequisites 5 | To use ProjToolV2, you need the following: 6 | - An Office 365 tenant with a Project license or a local project server Instance. 7 | - The SharePoint and Project libraries for [CSOM](https://www.nuget.org/packages/Microsoft.SharePointOnline.CSOM) 8 | 9 | ## Modules 10 | 1. Delete Objects (Provides ability to bulk delete objects from a project server instance ) 11 | - Delete Enterprise Projects. 12 | - Delete Enterprise Resources. 13 | - Delete Enterprise Calendars. 14 | - Delete Enterprise Custom Fields. 15 | - Delete Enterprise Lookup Tables. 16 | - UI supports sorting objects. 17 | 18 | 2. CheckIn/Out 19 | - Ability to force checkin/checkout projects. 20 | - Ablity to force checkin enterprise resources. 21 | - UI supports sorting objects. 22 | 23 | 3. Publish 24 | - Full publish multiple projects with a single click. 25 | - UI supports sorting objects. 26 | 27 | 4. Create (Provides ability to create bulk objects in a project server instance.) 28 | - Enterprise Projects 29 | - Enterprise Resources 30 | - Custom Fields 31 | - Lookup Tables 32 | 33 | 5. Update 34 | Update enterprise Projects - Provides ability to select a project and update its properties. 35 | 36 | ## Settings 37 | 38 | - Load all properties settings throttle whether to load all project properties or just the default project properties on Update Project module. 39 | - Throttles the logging level, but defaults only exceptions are logged. 40 | - When operations goes thru queue, "Wait for Queue Jobs" settings determines whether to return immediatly of wait until the job is complete. 41 | 42 | ## Copyright 43 | Copyright (c) 2016 Microsoft. All rights reserved. 44 | -------------------------------------------------------------------------------- /Copy-Work-Packages/Copy-Work-Packages.sample.yml: -------------------------------------------------------------------------------- 1 | ### YamlMime:Sample 2 | sample: 3 | - name: 'Project add-in: Copy Work Packages' 4 | path: Copy-Work-Packages 5 | description: The Copy Work Packages sample code demonstrates how to query for projects and tasks and create tasks using JSOM (CSOM). 6 | readme: '' 7 | generateZip: FALSE 8 | isLive: TRUE 9 | technologies: 10 | - Office Add-in 11 | azureDeploy: '' 12 | author: NadinMerali 13 | platforms: [] 14 | languages: 15 | - C# 16 | extensions: 17 | products: 18 | - Project 19 | scenarios: [] 20 | -------------------------------------------------------------------------------- /Copy-Work-Packages/Copy-Work-Packages.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.23107.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Copy-Work-Packages", "Copy-Work-Packages\Copy-Work-Packages.csproj", "{1802DE8C-7346-4BF5-AE8F-23EB181C4027}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {1802DE8C-7346-4BF5-AE8F-23EB181C4027}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {1802DE8C-7346-4BF5-AE8F-23EB181C4027}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {1802DE8C-7346-4BF5-AE8F-23EB181C4027}.Debug|Any CPU.Deploy.0 = Debug|Any CPU 17 | {1802DE8C-7346-4BF5-AE8F-23EB181C4027}.Release|Any CPU.ActiveCfg = Release|Any CPU 18 | {1802DE8C-7346-4BF5-AE8F-23EB181C4027}.Release|Any CPU.Build.0 = Release|Any CPU 19 | {1802DE8C-7346-4BF5-AE8F-23EB181C4027}.Release|Any CPU.Deploy.0 = Release|Any CPU 20 | EndGlobalSection 21 | GlobalSection(SolutionProperties) = preSolution 22 | HideSolutionNode = FALSE 23 | EndGlobalSection 24 | EndGlobal 25 | -------------------------------------------------------------------------------- /Copy-Work-Packages/Copy-Work-Packages/AppManifest.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 9 | 10 | Copy-Work-Packages 11 | ~appWebUrl/Pages/Default.aspx?{StandardTokens} 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /Copy-Work-Packages/Copy-Work-Packages/Content/App.css: -------------------------------------------------------------------------------- 1 | /* Place custom styles below */ 2 | .boxer { 3 | display: table; 4 | border-collapse: collapse; 5 | padding: 5px; 6 | } 7 | .boxer .box-row { 8 | display: table-row; 9 | } 10 | .boxer .box { 11 | display: table-cell; 12 | text-align: left; 13 | vertical-align: top; 14 | border: 0px; 15 | padding: 5px; 16 | } 17 | -------------------------------------------------------------------------------- /Copy-Work-Packages/Copy-Work-Packages/Content/Elements.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Copy-Work-Packages/Copy-Work-Packages/Content/SharePointProjectItem.spdata: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Copy-Work-Packages/Copy-Work-Packages/Copy-Work-Packages.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {1802DE8C-7346-4BF5-AE8F-23EB181C4027} 8 | Library 9 | Properties 10 | CopyWorkPackages 11 | CopyWorkPackages 12 | v4.5 13 | 16.1 14 | 512 15 | {C1CDDADD-2546-481F-9697-4EA41081F2FC};{14822709-B5A1-4724-98CA-57A101D1B079};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 16 | 12.0 17 | 12.2 18 | False 19 | SharePointApp 20 | {95dbfff6-ae30-45df-888e-f0bb54b36772} 21 | {86e711f0-886b-485b-a61a-6f207d3c98b6} 22 | {6f9d14e0-7c25-4675-aa67-f9b8cd45fa56} 23 | {810b9353-a9bb-42c8-b645-e927579fc436} 24 | {0459cf28-6533-420a-b8d1-b2a7f2205ad0} 25 | 26 | 27 | true 28 | full 29 | false 30 | bin\Debug\ 31 | DEBUG;TRACE 32 | prompt 33 | 4 34 | false 35 | 36 | 37 | pdbonly 38 | true 39 | bin\Release\ 40 | TRACE 41 | prompt 42 | 4 43 | false 44 | 45 | 46 | 47 | {1afa8f23-748f-48dc-8abc-8ee2aab9624a} 48 | 49 | 50 | 51 | 52 | 53 | 54 | {0459cf28-6533-420a-b8d1-b2a7f2205ad0} 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | {f612c30d-4c41-4010-8b5a-13d2c662c305} 63 | 64 | 65 | 66 | 67 | 68 | 69 | manifest-icon 70 | 71 | 72 | 73 | {da1fe2c1-89d5-43db-8988-fb3a5590b1b1} 74 | 75 | 76 | 77 | 78 | {f95854a2-2eee-4ece-8f44-767b6f7a59ad} 79 | 80 | 81 | Package.package 82 | 83 | 84 | {cc7c3c83-31cd-49c5-a603-45e014131795} 85 | 86 | 87 | CopyWorkTasks.feature 88 | 89 | 90 | 91 | 92 | Designer 93 | 94 | 95 | 96 | 97 | 10.0 98 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) 99 | 100 | 101 | -------------------------------------------------------------------------------- /Copy-Work-Packages/Copy-Work-Packages/Copy-Work-Packages.csproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | https://contoso.sharepoint.com/sites/pwa/ 5 | Microsoft Edge 6 | 7 | 8 | -------------------------------------------------------------------------------- /Copy-Work-Packages/Copy-Work-Packages/Features/CopyWorkTasks/CopyWorkTasks.Template.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | -------------------------------------------------------------------------------- /Copy-Work-Packages/Copy-Work-Packages/Features/CopyWorkTasks/CopyWorkTasks.feature: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Copy-Work-Packages/Copy-Work-Packages/Images/AppIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Project-Samples/7d131365acf017a07534bb69f3ae050dd4e4766e/Copy-Work-Packages/Copy-Work-Packages/Images/AppIcon.png -------------------------------------------------------------------------------- /Copy-Work-Packages/Copy-Work-Packages/Images/Elements.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Copy-Work-Packages/Copy-Work-Packages/Images/SharePointProjectItem.spdata: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Copy-Work-Packages/Copy-Work-Packages/Package/Package.Template.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | -------------------------------------------------------------------------------- /Copy-Work-Packages/Copy-Work-Packages/Package/Package.package: -------------------------------------------------------------------------------- 1 |  2 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Copy-Work-Packages/Copy-Work-Packages/Pages/Default.aspx: -------------------------------------------------------------------------------- 1 | <%-- The following 4 lines are ASP.NET directives needed when using SharePoint components --%> 2 | <%@ Page Inherits="Microsoft.SharePoint.WebPartPages.WebPartPage, Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" MasterPageFile="~masterurl/default.master" Language="C#" %> 3 | <%@ Register TagPrefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> 4 | <%@ Register TagPrefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> 5 | <%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> 6 | 7 | <%-- The markup and script in the following Content element will be placed in the of the page --%> 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | <%-- The markup in the following Content element will be placed in the TitleArea of the page --%> 21 | 22 | Copy Tasks 23 | 24 | 25 | <%-- The markup and script in the following Content element will be placed in the of the page --%> 26 | 27 | 28 |
29 |

30 | Hello 31 |

32 |
33 |
34 |
Project:
35 |
36 | 39 |
40 |
41 |
42 |
Summary Task:
43 |
44 | 47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
Project:
55 |
56 | 59 |
60 |
61 |
62 |
Summary Task:
63 |
64 | 67 |
68 |
69 |
70 | 71 | 72 |
73 | 76 |
77 |
78 |
-------------------------------------------------------------------------------- /Copy-Work-Packages/Copy-Work-Packages/Pages/Elements.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Copy-Work-Packages/Copy-Work-Packages/Pages/SharePointProjectItem.spdata: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Copy-Work-Packages/Copy-Work-Packages/Scripts/Elements.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Copy-Work-Packages/Copy-Work-Packages/Scripts/SharePointProjectItem.spdata: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Copy-Work-Packages/Copy-Work-Packages/Scripts/_references.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Project-Samples/7d131365acf017a07534bb69f3ae050dd4e4766e/Copy-Work-Packages/Copy-Work-Packages/Scripts/_references.js -------------------------------------------------------------------------------- /Copy-Work-Packages/README.md: -------------------------------------------------------------------------------- 1 | # Copy Work Packages 2 | 3 | The Copy Work Packages sample code demonstrates how to query for projects and tasks and create tasks using JSOM (CSOM). 4 | 5 | ## Scenario 6 | I have a common set of well-defined tasks (work packages) that I would like to re-use in many of my projects. I want to be able to easily select the work package and choose the project/task to copy the work package under. 7 | 8 | ## Setup 9 | 10 | 1. Create one or more projects that have a set of tasks that you would like to re-use. 11 | 2. Create a summary task to group the set and give it a meaningful description. 12 | 3. Publish the project. 13 | 14 | ### Using the app 15 | 16 | 1. Choose the (source) project containing the work package you are looking for. 17 | 2. Choose the work package (summary task). 18 | 3. Choose the (target) project you want to copy the work package to. 19 | 4. Choose a parent task where the work package will be copied to. 20 | 5. Click Submit. 21 | 22 | 23 | ### Prerequisites/Deployment 24 | To use this code sample, you need the following: 25 | * Project Server 2013 or Project Online (with subscription) 26 | * Visual Studio 2013 or later 27 | * App for SharePoint project type 28 | * Update the project site Url (Project Property) to match the site you are testing against. 29 | * If you are not using a Developer site collection, you may need to enable [Side Loading](https://blogs.msdn.microsoft.com/officeapps/2013/12/10/enable-app-sideloading-in-your-non-developer-site-collection/) 30 | 31 | 32 | 33 | ## How the sample affects your tenant data 34 | This sample runs CSOM methods that read project and read/create task data. Tenant data will be affected. 35 | 36 | ## Additional resources 37 | * [PS namespace (ps.js)](https://msdn.microsoft.com/en-us/library/office/jj669820.aspx) 38 | * [Client-side object model (CSOM) for Project 2013](https://msdn.microsoft.com/en-us/library/office/jj163123.aspx) 39 | * [SharePoint and Project Online SDK](https://www.nuget.org/packages/Microsoft.SharePointOnline.CSOM) 40 | 41 | ## Copyright 42 | Copyright (c) 2016 Microsoft. All rights reserved. 43 | -------------------------------------------------------------------------------- /Create-Update-Project-Samples/Create-Update-Project-Samples.sample.yml: -------------------------------------------------------------------------------- 1 | ### YamlMime:Sample 2 | sample: 3 | - name: 'Project add-in: Create and Update Project .NET Code Samples' 4 | path: Create-Update-Project-Samples 5 | description: The create and update sample code demonstrates how to create and update a project using CSOM and .Net 6 | readme: '' 7 | generateZip: FALSE 8 | isLive: TRUE 9 | technologies: 10 | - Office Add-in 11 | azureDeploy: '' 12 | author: superjijimouse 13 | platforms: [] 14 | languages: 15 | - C# 16 | extensions: 17 | products: 18 | - Project 19 | scenarios: [] 20 | -------------------------------------------------------------------------------- /Create-Update-Project-Samples/Create-Update-Project-Samples.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.24720.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CreateUpdateProjectSamples", "Create-Update-Project-Samples\CreateUpdateProjectSamples.csproj", "{E2A38845-3065-461B-80BB-8884396E48E6}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {E2A38845-3065-461B-80BB-8884396E48E6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {E2A38845-3065-461B-80BB-8884396E48E6}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {E2A38845-3065-461B-80BB-8884396E48E6}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {E2A38845-3065-461B-80BB-8884396E48E6}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /Create-Update-Project-Samples/Create-Update-Project-Samples/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Create-Update-Project-Samples/Create-Update-Project-Samples/CreateProject.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | using csom = Microsoft.ProjectServer.Client; 9 | 10 | namespace CreateUpdateProjectSample 11 | { 12 | partial class CreateUpdateProjectSample 13 | { 14 | 15 | 16 | /// 17 | /// Create a new project with one local resource, one enterprise resource, one task and one assignment 18 | /// 19 | public static void CreateProjectWithTaskAndAssignment() 20 | { 21 | // 22 | // Load csom context 23 | context = GetContext(pwaInstanceUrl); 24 | 25 | // 26 | // Create a project 27 | csom.PublishedProject project = context.Projects.Add(new csom.ProjectCreationInformation() 28 | { 29 | Name = projectName, 30 | Start = DateTime.Today, 31 | Description = "Created project from C# library" 32 | }); 33 | csom.JobState jobState = context.WaitForQueue(context.Projects.Update(), DEFAULTTIMEOUTSECONDS); 34 | JobStateLog(jobState, "Creating project"); 35 | 36 | // 37 | // Create a task in project 38 | context.Load(project, p => p, 39 | p => p.StartDate); //load startdate of project 40 | context.ExecuteQuery(); 41 | 42 | csom.DraftProject draft = project.CheckOut(); 43 | Guid taskId = Guid.NewGuid(); 44 | csom.Task task = draft.Tasks.Add(new csom.TaskCreationInformation() 45 | { 46 | Id = taskId, 47 | Name = taskName, 48 | IsManual = false, 49 | Start = project.StartDate.AddDays(1), 50 | Duration = "5d" 51 | }); 52 | 53 | draft.Update(); 54 | 55 | // 56 | // Create a local resource and assign the task to him 57 | Guid resourceId = Guid.NewGuid(); 58 | csom.ProjectResource resource = draft.ProjectResources.Add(new csom.ProjectResourceCreationInformation() 59 | { 60 | Id = resourceId, 61 | Name = localResourceName 62 | }); 63 | 64 | draft.Update(); 65 | 66 | csom.DraftAssignment assignment = draft.Assignments.Add(new csom.AssignmentCreationInformation() 67 | { 68 | ResourceId = resourceId, 69 | TaskId = taskId 70 | }); 71 | 72 | draft.Update(); 73 | jobState = context.WaitForQueue(draft.Publish(true), DEFAULTTIMEOUTSECONDS); // draft.Publish(true) means publish and check in 74 | JobStateLog(jobState, "Creating task and assgin to a local resource"); 75 | } 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /Create-Update-Project-Samples/Create-Update-Project-Samples/CreateUpdateProjectSample.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Net; 7 | 8 | using Microsoft.SharePoint.Client; 9 | using csom = Microsoft.ProjectServer.Client; 10 | 11 | namespace CreateUpdateProjectSample 12 | { 13 | partial class CreateUpdateProjectSample 14 | { 15 | public static string pwaInstanceUrl = "http://localhost/pwa/"; // your pwa url 16 | private static csom.ProjectContext context; 17 | const int DEFAULTTIMEOUTSECONDS = 300; 18 | 19 | private static string projectName = "New Project"; 20 | private static string localResourceName = "New Local Resource"; 21 | private static string taskName = "New Task"; 22 | 23 | private static string projectCFName = "Project custom field"; 24 | private static string resourceCFName = "Resource custom field"; 25 | private static string taskCFName = "Task custom field"; 26 | 27 | static void Main(string[] args) 28 | { 29 | CreateProjectWithTaskAndAssignment(); 30 | ReadAndUpdateProject(); 31 | UpdateCustomFieldValues(); 32 | } 33 | 34 | #region Utility functions 35 | /// 36 | /// Log to Console the job state for queued jobs 37 | /// 38 | /// csom jobstate 39 | /// job description 40 | private static void JobStateLog(csom.JobState jobState, string jobDescription) 41 | { 42 | switch (jobState) 43 | { 44 | case csom.JobState.Success: 45 | Console.WriteLine(jobDescription + " is successfully done."); 46 | break; 47 | case csom.JobState.ReadyForProcessing: 48 | case csom.JobState.Processing: 49 | case csom.JobState.ProcessingDeferred: 50 | Console.WriteLine(jobDescription + " is taking longer than usual."); 51 | break; 52 | case csom.JobState.Failed: 53 | case csom.JobState.FailedNotBlocking: 54 | case csom.JobState.CorrelationBlocked: 55 | Console.WriteLine(jobDescription + " failed. The job is in state: " + jobState); 56 | break; 57 | default: 58 | Console.WriteLine("Unkown error, job is in state " + jobState); 59 | break; 60 | } 61 | } 62 | 63 | /// 64 | /// Get Publish project by name 65 | /// 66 | /// the name of the project 67 | /// csom context 68 | /// 69 | private static csom.PublishedProject GetProjectByName(string name, csom.ProjectContext context) 70 | { 71 | IEnumerable projs = context.LoadQuery(context.Projects.Where(p => p.Name == name)); 72 | context.ExecuteQuery(); 73 | 74 | if (!projs.Any()) // no project found 75 | { 76 | return null; 77 | } 78 | return projs.FirstOrDefault(); 79 | } 80 | 81 | /// 82 | /// Get csom ProjectContext by letting user type in username and password 83 | /// 84 | /// pwa website url string 85 | /// 86 | private static csom.ProjectContext GetContext(string url) 87 | { 88 | csom.ProjectContext context = new csom.ProjectContext(url); 89 | string userName, passWord; 90 | 91 | Console.WriteLine("Please enter your username for PWA"); 92 | userName = Console.ReadLine(); 93 | Console.WriteLine("Please enter your password for PWA"); 94 | passWord = Console.ReadLine(); 95 | 96 | NetworkCredential netcred = new NetworkCredential(userName, passWord); 97 | SharePointOnlineCredentials orgIDCredential = new SharePointOnlineCredentials(netcred.UserName, netcred.SecurePassword); 98 | context.Credentials = orgIDCredential; 99 | 100 | return context; 101 | } 102 | 103 | #endregion 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /Create-Update-Project-Samples/Create-Update-Project-Samples/CreateUpdateProjectSamples.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {E2A38845-3065-461B-80BB-8884396E48E6} 8 | Exe 9 | Properties 10 | CreateUpdateProjectSamples 11 | CreateUpdateProjectSamples 12 | v4.5.2 13 | 512 14 | true 15 | 16 | 17 | AnyCPU 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | 26 | 27 | AnyCPU 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | 37 | dll\Microsoft.ProjectServer.Client.dll 38 | 39 | 40 | False 41 | ..\dll\microsoft.sharepoint.client.dll 42 | 43 | 44 | False 45 | ..\dll\microsoft.sharepoint.client.runtime.dll 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 74 | -------------------------------------------------------------------------------- /Create-Update-Project-Samples/Create-Update-Project-Samples/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Create-Update-Project-Samples")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Create-Update-Project-Samples")] 13 | [assembly: AssemblyCopyright("Copyright © 2016")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("e2a38845-3065-461b-80bb-8884396e48e6")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Create-Update-Project-Samples/Create-Update-Project-Samples/UpdateProject.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Globalization; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | using Microsoft.SharePoint.Client; 9 | using csom = Microsoft.ProjectServer.Client; 10 | 11 | namespace CreateUpdateProjectSample 12 | { 13 | partial class CreateUpdateProjectSample 14 | { 15 | /// 16 | /// Read and update the project, 17 | /// this method need a project named "New Project" with a task "New task" and assign to a local resource named "New local resource" already created. 18 | /// Basically please run CreateProjectWithTaskAndAssignment() before running this to avoid exceptions 19 | /// 20 | public static void ReadAndUpdateProject() 21 | { 22 | // Load csom context 23 | context = GetContext(pwaInstanceUrl); 24 | 25 | // Retrieve publish project named "New Project" 26 | // if you know the Guid of project, you can just call context.Projects.GetByGuid() 27 | csom.PublishedProject project = GetProjectByName(projectName, context); 28 | if(project == null) 29 | { 30 | Console.WriteLine("Failed to retrieve expected data, make sure you set up server data right. Press any key to continue...."); 31 | return; 32 | } 33 | 34 | csom.DraftProject draft = project.CheckOut(); 35 | 36 | // Retrieve project along with tasks & resources 37 | context.Load(draft, p => p.StartDate, 38 | p => p.Description); 39 | context.Load(draft.Tasks, dt => dt.Where(t => t.Name == taskName)); 40 | context.Load(draft.Assignments, da => da.Where(a => a.Task.Name == taskName && 41 | a.Resource.Name == localResourceName)); 42 | context.Load(draft.ProjectResources, dp => dp.Where(r => r.Name == localResourceName)); 43 | context.ExecuteQuery(); 44 | 45 | // Make sure the data on server is right 46 | if (draft.Tasks.Count !=1 || draft.Assignments.Count != 1 || draft.ProjectResources.Count != 1) 47 | { 48 | Console.WriteLine("Failed to retrieve expected data, make sure you set up server data right. Press any key to continue...."); 49 | Console.ReadLine(); 50 | return; 51 | } 52 | 53 | // Since we already filetered and validated that the TaskCollection, ProjectResourceCollection and AssignmentCollection 54 | // contains just one filtered item each, we just get the first one. 55 | csom.DraftTask task = draft.Tasks.First(); 56 | csom.DraftProjectResource resource = draft.ProjectResources.First(); 57 | csom.DraftAssignment assignment = draft.Assignments.First(); 58 | 59 | // Update the project description 60 | draft.Description += "(description updated)"; 61 | 62 | // Update task duration and start date 63 | task.Duration = "10d"; 64 | task.Start = draft.StartDate.AddDays(3); 65 | draft.Update(); // Save updates so far to ensure the task changes are applied before the assignment changes 66 | 67 | // Update resource standard rate 68 | resource.StandardRate = 100.0d; 69 | draft.Update(); 70 | 71 | // Update assignment work percent complete 72 | assignment.PercentWorkComplete = 50; 73 | 74 | // Publish and check in the project 75 | csom.JobState jobState = context.WaitForQueue(draft.Publish(true), DEFAULTTIMEOUTSECONDS); 76 | JobStateLog(jobState, "Updating project"); 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /Create-Update-Project-Samples/Create-Update-Project-Samples/dll/Microsoft.ProjectServer.Client.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Project-Samples/7d131365acf017a07534bb69f3ae050dd4e4766e/Create-Update-Project-Samples/Create-Update-Project-Samples/dll/Microsoft.ProjectServer.Client.dll -------------------------------------------------------------------------------- /Create-Update-Project-Samples/Create-Update-Project-Samples/dll/microsoft.sharepoint.client.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Project-Samples/7d131365acf017a07534bb69f3ae050dd4e4766e/Create-Update-Project-Samples/Create-Update-Project-Samples/dll/microsoft.sharepoint.client.dll -------------------------------------------------------------------------------- /Create-Update-Project-Samples/Create-Update-Project-Samples/dll/microsoft.sharepoint.client.runtime.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Project-Samples/7d131365acf017a07534bb69f3ae050dd4e4766e/Create-Update-Project-Samples/Create-Update-Project-Samples/dll/microsoft.sharepoint.client.runtime.dll -------------------------------------------------------------------------------- /Create-Update-Project-Samples/README.md: -------------------------------------------------------------------------------- 1 | # Create and Update Project .Net Code Samples 2 | 3 | The create and update sample code demonstrates how to create and update a project using CSOM and .NET. 4 | 5 | ## Prerequisites 6 | To use this Project Online ReST code sample, you need the following: 7 | * An Office 365 tenant with a Project license 8 | * The SharePoint client runtime and Project .Net libraries. It is available as a Nuget Package from [here](https://www.nuget.org/packages/Microsoft.SharePointOnline.CSOM/) 9 | * Visual Studio or other .NET IDE 10 | 11 | ## Modules 12 | * [CreateProject](/Create-Update-Project-Samples/Create-Update-Project-Samples/CreateProject.cs) 13 | * [UpdateProject](/Create-Update-Project-Samples/Create-Update-Project-Samples/UpdateProject.cs) 14 | * [UpdateProjectCustomFields](/Create-Update-Project-Samples/Create-Update-Project-Samples/UpdateProjectCustomFieldValues.cs) 15 | 16 | ## How the sample affects your tenant data 17 | This sample runs CSOM methods that create, read, update, or delete data. When running commands that delete or edit data, the sample creates sample data. The sample data is created or edited so that your actual tenant data is unaffected. 18 | 19 | ## Additional resources 20 | * [Client-side object model (CSOM) for Project 2013](https://msdn.microsoft.com/en-us/library/office/jj163123.aspx) 21 | * [SharePoint and Project Online SDK](https://www.nuget.org/packages/Microsoft.SharePointOnline.CSOM) 22 | 23 | ## Copyright 24 | Copyright (c) 2016 Microsoft. All rights reserved. 25 | -------------------------------------------------------------------------------- /My-Task-Checklist/ClaimsAuth/ClaimClientContext.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Net; 6 | using System.Net.Security; 7 | using System.Security.Cryptography.X509Certificates; 8 | using Microsoft.SharePoint.Client; 9 | 10 | 11 | namespace MSDN.Samples.ClaimsAuth 12 | { 13 | public static class ClaimClientContext 14 | { 15 | /// 16 | /// Displays a pop up to login the user. An authentication Cookie is returned if the user is sucessfully authenticated. 17 | /// 18 | /// 19 | /// 20 | /// 21 | /// 22 | public static CookieCollection GetAuthenticatedCookies(string targetSiteUrl, int popUpWidth, int popUpHeight) 23 | { 24 | CookieCollection authCookie = null; 25 | using (ClaimsWebAuth webAuth = new ClaimsWebAuth(targetSiteUrl, popUpWidth, popUpHeight)) 26 | { 27 | authCookie = webAuth.Show(); 28 | } 29 | return authCookie; 30 | } 31 | 32 | /// 33 | /// Override for for displaying pop. Default width and height values are used for the pop up window. 34 | /// 35 | /// 36 | /// 37 | public static void GetAuthenticatedContext(T context) where T : ClientContext 38 | { 39 | GetAuthenticatedContext(context, 0, 0); 40 | } 41 | 42 | /// 43 | /// Override for for displaying pop. Default width and height values are used for the pop up window. 44 | /// 45 | /// 46 | /// 47 | public static T GetAuthenticatedContext(string targetSiteUrl) where T : ClientContext 48 | { 49 | T context = (T)Activator.CreateInstance(typeof(T), targetSiteUrl); 50 | return (GetAuthenticatedContext(context, 0, 0)); 51 | } 52 | /// 53 | /// This method will return a ClientContext object with the authentication cookie set. 54 | /// The ClientContext should be disposed of as any other IDisposable 55 | /// 56 | /// 57 | /// 58 | public static T GetAuthenticatedContext(T context, int popUpWidth, int popUpHeight) where T : ClientContext 59 | { 60 | CookieCollection cookies = null; 61 | cookies = ClaimClientContext.GetAuthenticatedCookies(context.Url, popUpWidth, popUpHeight); 62 | if (cookies == null) return null; 63 | 64 | try 65 | { 66 | context.ExecutingWebRequest += delegate (object sender, WebRequestEventArgs e) 67 | { 68 | e.WebRequestExecutor.WebRequest.CookieContainer = new CookieContainer(); 69 | foreach (Cookie cookie in cookies) 70 | { 71 | e.WebRequestExecutor.WebRequest.CookieContainer.Add(cookie); 72 | } 73 | }; 74 | } 75 | catch 76 | { 77 | if (context != null) context.Dispose(); 78 | throw; 79 | } 80 | 81 | return context; 82 | } 83 | 84 | /// 85 | /// This method will return a ClientContext object with the authentication cookie set. 86 | /// The ClientContext should be disposed of as any other IDisposable 87 | /// 88 | /// 89 | /// 90 | public static ClientContext GetAuthenticatedContext(string targetSiteUrl, int popUpWidth, int popUpHeight) 91 | { 92 | 93 | 94 | ClientContext context = new ClientContext(targetSiteUrl); 95 | GetAuthenticatedContext(context, popUpWidth, popUpHeight); 96 | return context; 97 | } 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /My-Task-Checklist/ClaimsAuth/ClaimsAuth.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 10.00 3 | # Visual Studio 2008 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClaimsAuth", "ClaimsAuth.csproj", "{2F63BAE9-2A4A-4027-9937-C1A63731B17D}" 5 | EndProject 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sp_Ctx", "..\Sp_Ctx\Sp_Ctx.csproj", "{AE983056-F81C-4B8C-B685-FCBE7BE91E6E}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Debug|Mixed Platforms = Debug|Mixed Platforms 12 | Debug|x86 = Debug|x86 13 | Release|Any CPU = Release|Any CPU 14 | Release|Mixed Platforms = Release|Mixed Platforms 15 | Release|x86 = Release|x86 16 | EndGlobalSection 17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 18 | {2F63BAE9-2A4A-4027-9937-C1A63731B17D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 19 | {2F63BAE9-2A4A-4027-9937-C1A63731B17D}.Debug|Any CPU.Build.0 = Debug|Any CPU 20 | {2F63BAE9-2A4A-4027-9937-C1A63731B17D}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU 21 | {2F63BAE9-2A4A-4027-9937-C1A63731B17D}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU 22 | {2F63BAE9-2A4A-4027-9937-C1A63731B17D}.Debug|x86.ActiveCfg = Debug|Any CPU 23 | {2F63BAE9-2A4A-4027-9937-C1A63731B17D}.Release|Any CPU.ActiveCfg = Release|Any CPU 24 | {2F63BAE9-2A4A-4027-9937-C1A63731B17D}.Release|Any CPU.Build.0 = Release|Any CPU 25 | {2F63BAE9-2A4A-4027-9937-C1A63731B17D}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU 26 | {2F63BAE9-2A4A-4027-9937-C1A63731B17D}.Release|Mixed Platforms.Build.0 = Release|Any CPU 27 | {2F63BAE9-2A4A-4027-9937-C1A63731B17D}.Release|x86.ActiveCfg = Release|Any CPU 28 | {AE983056-F81C-4B8C-B685-FCBE7BE91E6E}.Debug|Any CPU.ActiveCfg = Debug|x86 29 | {AE983056-F81C-4B8C-B685-FCBE7BE91E6E}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 30 | {AE983056-F81C-4B8C-B685-FCBE7BE91E6E}.Debug|Mixed Platforms.Build.0 = Debug|x86 31 | {AE983056-F81C-4B8C-B685-FCBE7BE91E6E}.Debug|x86.ActiveCfg = Debug|x86 32 | {AE983056-F81C-4B8C-B685-FCBE7BE91E6E}.Debug|x86.Build.0 = Debug|x86 33 | {AE983056-F81C-4B8C-B685-FCBE7BE91E6E}.Release|Any CPU.ActiveCfg = Release|x86 34 | {AE983056-F81C-4B8C-B685-FCBE7BE91E6E}.Release|Mixed Platforms.ActiveCfg = Release|x86 35 | {AE983056-F81C-4B8C-B685-FCBE7BE91E6E}.Release|Mixed Platforms.Build.0 = Release|x86 36 | {AE983056-F81C-4B8C-B685-FCBE7BE91E6E}.Release|x86.ActiveCfg = Release|x86 37 | {AE983056-F81C-4B8C-B685-FCBE7BE91E6E}.Release|x86.Build.0 = Release|x86 38 | EndGlobalSection 39 | GlobalSection(SolutionProperties) = preSolution 40 | HideSolutionNode = FALSE 41 | EndGlobalSection 42 | EndGlobal 43 | -------------------------------------------------------------------------------- /My-Task-Checklist/ClaimsAuth/Constants.cs: -------------------------------------------------------------------------------- 1 | namespace MSDN.Samples.ClaimsAuth 2 | { 3 | public static class Constants 4 | { 5 | public const string WR_METHOD_OPTIONS = "OPTIONS"; 6 | 7 | public const string FED_AUTH_COOKIE_NAME = "FedAuth"; 8 | 9 | public const string CLAIM_HEADER_RETURN_URL = "X-Forms_Based_Auth_Return_Url"; 10 | public const string CLAIM_HEADER_AUTH_REQUIRED = "X-FORMS_BASED_AUTH_REQUIRED"; 11 | 12 | // messages 13 | public const string MSG_REQUIRED_SITE_URL = "The Site URL is required."; 14 | public const string MSG_NOT_CLAIM_SITE = "The requested site does not appear to have claims enabled or the Login Url has not been set."; 15 | 16 | public const int DEFAULT_POP_UP_WIDTH = 925; 17 | public const int DEFAULT_POP_UP_HEIGHT = 525; 18 | 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /My-Task-Checklist/ClaimsAuth/CookieReader.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Runtime.InteropServices; 6 | 7 | namespace MSDN.Samples.ClaimsAuth 8 | { 9 | /// 10 | /// WinInet.dll wrapper 11 | /// 12 | internal static class CookieReader 13 | { 14 | /// 15 | /// Enables the retrieval of cookies that are marked as "HTTPOnly". 16 | /// Do not use this flag if you expose a scriptable interface, 17 | /// because this has security implications. It is imperative that 18 | /// you use this flag only if you can guarantee that you will never 19 | /// expose the cookie to third-party code by way of an 20 | /// extensibility mechanism you provide. 21 | /// Version: Requires Internet Explorer 8.0 or later. 22 | /// 23 | private const int INTERNET_COOKIE_HTTPONLY = 0x00002000; 24 | 25 | [DllImport("wininet.dll", SetLastError = true)] 26 | private static extern bool InternetGetCookieEx( 27 | string url, 28 | string cookieName, 29 | StringBuilder cookieData, 30 | ref int size, 31 | int flags, 32 | IntPtr pReserved); 33 | 34 | /// 35 | /// Returns cookie contents as a string 36 | /// 37 | /// 38 | /// 39 | public static string GetCookie(string url) 40 | { 41 | 42 | int size = 512; 43 | StringBuilder sb = new StringBuilder(size); 44 | if (!InternetGetCookieEx(url, null, sb, ref size, INTERNET_COOKIE_HTTPONLY, IntPtr.Zero)) 45 | { 46 | if (size < 0) 47 | { 48 | return null; 49 | } 50 | sb = new StringBuilder(size); 51 | if (!InternetGetCookieEx(url, null, sb, ref size, INTERNET_COOKIE_HTTPONLY, IntPtr.Zero)) 52 | { 53 | return null; 54 | } 55 | } 56 | return sb.ToString(); 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /My-Task-Checklist/ClaimsAuth/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("ClaimsAuth")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft")] 12 | [assembly: AssemblyProduct("ClaimsAuth")] 13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2010")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("d41377c9-9e8c-4259-915e-2a34c4829408")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /My-Task-Checklist/ClaimsAuth/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /My-Task-Checklist/My-Task-Checklis.sample.yml: -------------------------------------------------------------------------------- 1 | ### YamlMime:Sample 2 | sample: 3 | - name: 'Project add-in: My Task Checklist' 4 | path: My-Task-Checklist 5 | description: The My Task Checklist sample code demonstrates how to query for assignments for the current user and to submit status updates (complete/incomplete) using C# CSOM. It also demonstrates how to authenticate against Project online without directly passing the credentials to the application. 6 | readme: '' 7 | generateZip: FALSE 8 | isLive: TRUE 9 | technologies: 10 | - Office Add-in 11 | azureDeploy: '' 12 | author: NadinMerali 13 | platforms: [] 14 | languages: 15 | - C# 16 | extensions: 17 | products: 18 | - Project 19 | scenarios: [] 20 | -------------------------------------------------------------------------------- /My-Task-Checklist/My-Task-Checklist.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.23107.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "My-Task-Checklist", "My-Task-Checklist\My-Task-Checklist.csproj", "{C469C026-982E-4AA2-81FB-63FA0836170C}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClaimsAuth", "ClaimsAuth\ClaimsAuth.csproj", "{2F63BAE9-2A4A-4027-9937-C1A63731B17D}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Any CPU = Debug|Any CPU 13 | Release|Any CPU = Release|Any CPU 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {C469C026-982E-4AA2-81FB-63FA0836170C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 17 | {C469C026-982E-4AA2-81FB-63FA0836170C}.Debug|Any CPU.Build.0 = Debug|Any CPU 18 | {C469C026-982E-4AA2-81FB-63FA0836170C}.Release|Any CPU.ActiveCfg = Release|Any CPU 19 | {C469C026-982E-4AA2-81FB-63FA0836170C}.Release|Any CPU.Build.0 = Release|Any CPU 20 | {2F63BAE9-2A4A-4027-9937-C1A63731B17D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {2F63BAE9-2A4A-4027-9937-C1A63731B17D}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {2F63BAE9-2A4A-4027-9937-C1A63731B17D}.Release|Any CPU.ActiveCfg = Release|Any CPU 23 | {2F63BAE9-2A4A-4027-9937-C1A63731B17D}.Release|Any CPU.Build.0 = Release|Any CPU 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | EndGlobal 29 | -------------------------------------------------------------------------------- /My-Task-Checklist/My-Task-Checklist/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /My-Task-Checklist/My-Task-Checklist/Assignment.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace MyTaskCheckList 4 | { 5 | /// 6 | /// Simple object that represents an assignment. Using it to keep track of the assignment properties including when it is dirty. 7 | /// 8 | public class Assignment 9 | { 10 | private string name; 11 | private Guid id; 12 | private bool done; 13 | private bool dirty; 14 | 15 | 16 | public Assignment(string taskName, Guid taskID, bool taskDone) 17 | { 18 | name = taskName; 19 | id = taskID; 20 | done = taskDone; 21 | dirty = false; 22 | } 23 | 24 | public override string ToString() 25 | { 26 | return name; 27 | } 28 | 29 | public bool Done 30 | { 31 | get 32 | { 33 | return done; 34 | } 35 | set 36 | { 37 | done = value; 38 | dirty = true; 39 | } 40 | 41 | } 42 | 43 | public Guid ID 44 | { 45 | get 46 | { 47 | return id; 48 | } 49 | 50 | } 51 | 52 | 53 | public bool Dirty 54 | { 55 | set { 56 | dirty = value; 57 | } 58 | 59 | get 60 | { 61 | return dirty; 62 | } 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /My-Task-Checklist/My-Task-Checklist/My-Task-CheckList.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.Windows.Forms; 6 | 7 | namespace MyTaskCheckList 8 | { 9 | static class Program 10 | { 11 | /// 12 | /// The main entry point for the application. 13 | /// 14 | [STAThread] 15 | static void Main() 16 | { 17 | Application.EnableVisualStyles(); 18 | Application.SetCompatibleTextRenderingDefault(false); 19 | Application.Run(new frmMyCheckList()); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /My-Task-Checklist/My-Task-Checklist/My-Task-Checklist.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {C469C026-982E-4AA2-81FB-63FA0836170C} 8 | WinExe 9 | Properties 10 | MyTaskCheckList 11 | MyTaskCheckList 12 | v4.5.2 13 | 512 14 | true 15 | 16 | 17 | AnyCPU 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | 26 | 27 | AnyCPU 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | Form 52 | 53 | 54 | frmCheckList.cs 55 | 56 | 57 | 58 | 59 | frmCheckList.cs 60 | 61 | 62 | ResXFileCodeGenerator 63 | Resources.Designer.cs 64 | Designer 65 | 66 | 67 | True 68 | Resources.resx 69 | 70 | 71 | SettingsSingleFileGenerator 72 | Settings.Designer.cs 73 | 74 | 75 | True 76 | Settings.settings 77 | True 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | {2f63bae9-2a4a-4027-9937-c1a63731b17d} 86 | ClaimsAuth 87 | 88 | 89 | 90 | 97 | -------------------------------------------------------------------------------- /My-Task-Checklist/My-Task-Checklist/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("MyTaskCheckList")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("MyTaskCheckList")] 13 | [assembly: AssemblyCopyright("Copyright © 2016")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("c469c026-982e-4aa2-81fb-63fa0836170c")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /My-Task-Checklist/My-Task-Checklist/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace MyTaskCheckList.Properties 12 | { 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources 26 | { 27 | 28 | private static global::System.Resources.ResourceManager resourceMan; 29 | 30 | private static global::System.Globalization.CultureInfo resourceCulture; 31 | 32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 33 | internal Resources() 34 | { 35 | } 36 | 37 | /// 38 | /// Returns the cached ResourceManager instance used by this class. 39 | /// 40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 41 | internal static global::System.Resources.ResourceManager ResourceManager 42 | { 43 | get 44 | { 45 | if ((resourceMan == null)) 46 | { 47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MyTaskCheckList.Properties.Resources", typeof(Resources).Assembly); 48 | resourceMan = temp; 49 | } 50 | return resourceMan; 51 | } 52 | } 53 | 54 | /// 55 | /// Overrides the current thread's CurrentUICulture property for all 56 | /// resource lookups using this strongly typed resource class. 57 | /// 58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 59 | internal static global::System.Globalization.CultureInfo Culture 60 | { 61 | get 62 | { 63 | return resourceCulture; 64 | } 65 | set 66 | { 67 | resourceCulture = value; 68 | } 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /My-Task-Checklist/My-Task-Checklist/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | text/microsoft-resx 107 | 108 | 109 | 2.0 110 | 111 | 112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 113 | 114 | 115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | -------------------------------------------------------------------------------- /My-Task-Checklist/My-Task-Checklist/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace MyTaskCheckList.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 18 | { 19 | 20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 21 | 22 | public static Settings Default 23 | { 24 | get 25 | { 26 | return defaultInstance; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /My-Task-Checklist/My-Task-Checklist/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /My-Task-Checklist/My-Task-Checklist/frmCheckList.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace MyTaskCheckList 2 | { 3 | partial class frmMyCheckList 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.btnSubmit = new System.Windows.Forms.Button(); 32 | this.chkAssignments = new System.Windows.Forms.CheckedListBox(); 33 | this.lblUserName = new System.Windows.Forms.Label(); 34 | this.btnConnect = new System.Windows.Forms.Button(); 35 | this.txtPWASite = new System.Windows.Forms.TextBox(); 36 | this.SuspendLayout(); 37 | // 38 | // btnSubmit 39 | // 40 | this.btnSubmit.Location = new System.Drawing.Point(354, 248); 41 | this.btnSubmit.Name = "btnSubmit"; 42 | this.btnSubmit.Size = new System.Drawing.Size(113, 36); 43 | this.btnSubmit.TabIndex = 4; 44 | this.btnSubmit.Text = "&Submit"; 45 | this.btnSubmit.UseVisualStyleBackColor = true; 46 | this.btnSubmit.Click += new System.EventHandler(this.btnSubmit_Click); 47 | // 48 | // chkAssignments 49 | // 50 | this.chkAssignments.CheckOnClick = true; 51 | this.chkAssignments.FormattingEnabled = true; 52 | this.chkAssignments.Location = new System.Drawing.Point(12, 58); 53 | this.chkAssignments.Name = "chkAssignments"; 54 | this.chkAssignments.Size = new System.Drawing.Size(455, 184); 55 | this.chkAssignments.TabIndex = 3; 56 | this.chkAssignments.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.chkAssignments_ItemCheck); 57 | // 58 | // lblUserName 59 | // 60 | this.lblUserName.AutoSize = true; 61 | this.lblUserName.Location = new System.Drawing.Point(12, 42); 62 | this.lblUserName.Name = "lblUserName"; 63 | this.lblUserName.Size = new System.Drawing.Size(52, 13); 64 | this.lblUserName.TabIndex = 2; 65 | this.lblUserName.Text = "Welcome"; 66 | // 67 | // btnConnect 68 | // 69 | this.btnConnect.Location = new System.Drawing.Point(354, 12); 70 | this.btnConnect.Name = "btnConnect"; 71 | this.btnConnect.Size = new System.Drawing.Size(113, 27); 72 | this.btnConnect.TabIndex = 1; 73 | this.btnConnect.Text = "&Connect"; 74 | this.btnConnect.UseVisualStyleBackColor = true; 75 | this.btnConnect.Click += new System.EventHandler(this.btnConnect_Click); 76 | // 77 | // txtPWASite 78 | // 79 | this.txtPWASite.Location = new System.Drawing.Point(12, 17); 80 | this.txtPWASite.Name = "txtPWASite"; 81 | this.txtPWASite.Size = new System.Drawing.Size(336, 20); 82 | this.txtPWASite.TabIndex = 0; 83 | this.txtPWASite.Text = "https://contoso.sharepoint.com/sites/pwa"; 84 | // 85 | // frmMyCheckList 86 | // 87 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 88 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 89 | this.ClientSize = new System.Drawing.Size(479, 291); 90 | this.Controls.Add(this.txtPWASite); 91 | this.Controls.Add(this.lblUserName); 92 | this.Controls.Add(this.btnConnect); 93 | this.Controls.Add(this.btnSubmit); 94 | this.Controls.Add(this.chkAssignments); 95 | this.Name = "frmMyCheckList"; 96 | this.Text = "My CheckList"; 97 | this.ResumeLayout(false); 98 | this.PerformLayout(); 99 | 100 | } 101 | 102 | #endregion 103 | 104 | private System.Windows.Forms.Button btnSubmit; 105 | private System.Windows.Forms.CheckedListBox chkAssignments; 106 | private System.Windows.Forms.Label lblUserName; 107 | private System.Windows.Forms.Button btnConnect; 108 | private System.Windows.Forms.TextBox txtPWASite; 109 | } 110 | } 111 | 112 | -------------------------------------------------------------------------------- /My-Task-Checklist/My-Task-Checklist/frmCheckList.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /My-Task-Checklist/README.md: -------------------------------------------------------------------------------- 1 | # My Task Checklist 2 | 3 | The My Task Checklist sample code demonstrates how to query for assignments for the current user and to submit status updates (complete/incomplete) using C# CSOM. It also demonstrates how to authenticate against Project online without directly passing the credentials to the application. 4 | 5 | ## Scenario 6 | As a team member, I want to be able to see my assignments and quickly check them off to mark them as complete. 7 | 8 | 9 | ### Using App 10 | 11 | 1. Choose the PWA site you want to connect to and click connect. 12 | 2. Authenticate as a team member. 13 | 3. Check and uncheck assignments 14 | 5. Click Submit. 15 | 16 | 17 | ### Prerequisites/Deployment 18 | To use this code sample, you need the following: 19 | * Project Online 20 | * Visual Studio 2013 or later 21 | * Project CSOM client library. It is available as a Nuget Package from [here](https://www.nuget.org/packages/Microsoft.SharePointOnline.CSOM/) 22 | 23 | 24 | 25 | ## How the sample affects your tenant data 26 | This sample runs CSOM methods that read assignment information for the logged in user and will update the percent complete. Tenant data will be affected. 27 | 28 | ## Additional resources 29 | * [Client-side object model (CSOM) for Project 2013](https://msdn.microsoft.com/en-us/library/office/jj163123.aspx) 30 | * [SharePoint and Project Online SDK](https://www.nuget.org/packages/Microsoft.SharePointOnline.CSOM) 31 | 32 | ## Copyright 33 | Copyright (c) 2016 Microsoft. All rights reserved. 34 | -------------------------------------------------------------------------------- /O365-Project-Online-JavaScript-Samples/O365-Project-Online-JavaScript-Samples.sample.yml: -------------------------------------------------------------------------------- 1 | ### YamlMime:Sample 2 | sample: 3 | - name: 'Project add-in: Office 365 Project Online JavaScript Code Sample' 4 | path: O365-Project-Online-JavaScript-Samples 5 | description: This Project Online JSOM code sample demonstrates how to create and update a project using JavaScript 6 | readme: '' 7 | generateZip: FALSE 8 | isLive: TRUE 9 | technologies: 10 | - Office Add-in 11 | azureDeploy: '' 12 | author: NadinMerali 13 | platforms: [] 14 | languages: 15 | - JavaScript 16 | extensions: 17 | products: 18 | - Project 19 | - Office 365 20 | scenarios: [] 21 | -------------------------------------------------------------------------------- /O365-Project-Online-JavaScript-Samples/README.md: -------------------------------------------------------------------------------- 1 | # Office 365 Project Online JavaScript Code Sample 2 | 3 | This Project Online JSOM code sample demonstrates how to create and update a project using JavaScript. 4 | 5 | ## Prerequisites 6 | 7 | To use this Project Online JSOM code sample, you need the following: 8 | * An Office 365 tenant with a Project license 9 | * The SharePoint and Project JavaScript libraries for CSOM 10 | 11 | ## Modules 12 | * [CreateProject](/O365-Project-Online-JavaScript-Samples/createproject.js) 13 | * [UpdateProject](/O365-Project-Online-JavaScript-Samples/updateproject.js) 14 | * [UpdateProjectCustomFields](/O365-Project-Online-JavaScript-Samples/updateprojectcustomfieldvalues.js) 15 | 16 | ## How the sample affects your tenant data 17 | This sample runs JSOM commands that create, read, update, or delete data. When running commands that delete or edit data, the sample creates fake entities. The fake entities are created or edited so that your actual tenant data is unaffected. The sample will leave behind fake entities on your tenant. 18 | 19 | ## Questions or comments? 20 | 21 | Join our monthly community call on second Wednesday of each month at 8:00 AM Pacific Time. Download the calendar invite at [https://aka.ms/officeaddinscommunitycall](https://aka.ms/officeaddinscommunitycall). 22 | 23 | ## Additional resources 24 | * [PS namespace (ps.js)](https://docs.microsoft.com/previous-versions/office/project-javascript-api/jj669820(v=office.15)) 25 | * [Client-side object model (CSOM) for Project 2013](https://docs.microsoft.com/office/client-developer/project/client-side-object-model-csom-for-project-2013) 26 | * [JavaScript library and REST reference for Project Server 2013](https://docs.microsoft.com/en-us/previous-versions/office/project-javascript-api/jj712612(v=office.15)) 27 | 28 | ## Copyright 29 | Copyright (c) 2015 Microsoft. All rights reserved. 30 | -------------------------------------------------------------------------------- /O365-Project-Online-JavaScript-Samples/createproject.js: -------------------------------------------------------------------------------- 1 | /* Creates a new project with one resource, one task and one assignment */ 2 | function CreateProject() { 3 | /* Store the entity names we're trying to create in some global variables */ 4 | var project_name = 'new project'; 5 | var resource_name = 'new resource'; 6 | var task_name = 'new task'; 7 | 8 | /* Callback for success/failure */ 9 | function WaitForQueueCallback(job_state) { 10 | switch (job_state) { 11 | case PS.JobState.success: 12 | alert("Successfully created a new project with name '" + project_name + "'."); 13 | break; 14 | case PS.JobState.readyForProcessing: 15 | case PS.JobState.processing: 16 | case PS.JobState.processingDeferred: 17 | alert("Creating the new project with name '" + project_name + "' is taking longer than usual."); 18 | break; 19 | case PS.JobState.failed: 20 | case PS.JobState.failedNotBlocking: 21 | case PS.JobState.correlationBlocked: 22 | alert("Failed to create a new project. The creation job is in state " + job_state); 23 | break; 24 | default: 25 | alert("Unknown error, job is in state " + job_state); 26 | } 27 | } 28 | 29 | // Function to generate GUIDs (https://stackoverflow.com/questions/105034/create-guid-uuid-in-javascript/2117523) 30 | function NewGuid() { 31 | return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { 32 | var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8); 33 | return v.toString(16); 34 | }) 35 | } 36 | 37 | // Initializes the current client context. 38 | var context = PS.ProjectContext.get_current(); 39 | 40 | // Creates the new project 41 | var new_project = new PS.ProjectCreationInformation(); 42 | new_project.set_name(project_name); 43 | new_project.set_start('01/01/2015'); 44 | 45 | var project_list = context.get_projects(); 46 | var project = project_list.add(new_project).get_draft(); 47 | 48 | // Creates a new local resource 49 | var new_resource_id = NewGuid(); 50 | var new_resource = new PS.ProjectResourceCreationInformation(); 51 | new_resource.set_name(resource_name); 52 | new_resource.set_id(new_resource_id); 53 | 54 | var project_resources_list = project.get_projectResources(); 55 | var project_resource = project_resources_list.add(new_resource); 56 | 57 | // Creates a new task in the project 58 | var new_task_id = NewGuid(); 59 | var new_task = new PS.TaskCreationInformation(); 60 | new_task.set_name(task_name); 61 | new_task.set_duration('5d'); 62 | new_task.set_id(new_task_id); 63 | 64 | var task_list = project.get_tasks(); 65 | task_list.add(new_task); 66 | 67 | // Creates an assignment for the new task and resource 68 | var new_assignment = new PS.AssignmentCreationInformation(); 69 | new_assignment.set_resourceId(new_resource_id); 70 | new_assignment.set_taskId(new_task_id); 71 | 72 | var assignment_list = project.get_assignments(); 73 | assignment_list.add(new_assignment); 74 | 75 | // Sends the request for project creation and publishing 76 | var queue_job = project_list.update(); 77 | 78 | context.waitForQueueAsync(queue_job, 60, WaitForQueueCallback); 79 | } -------------------------------------------------------------------------------- /O365-Project-Online-JavaScript-Samples/updateproject.js: -------------------------------------------------------------------------------- 1 | /* Updates project, task, project resource and assignment intrinsic field */ 2 | function UpdateProject() { 3 | /* Store the entity names we're trying to update in some global variables*/ 4 | /* This code assumes a project/task/resource with these names already exists */ 5 | var project_name = 'new project'; 6 | var resource_name = 'new resource'; 7 | var task_name = 'new task'; 8 | 9 | /* Callback for success/failure */ 10 | function WaitForQueueCallback(job_state) { 11 | switch (job_state) { 12 | case PS.JobState.success: 13 | alert("Successfully updated the project with name '" + project_name + "'."); 14 | break; 15 | case PS.JobState.readyForProcessing: 16 | case PS.JobState.processing: 17 | case PS.JobState.processingDeferred: 18 | alert("Updating the project with name '" + project_name + "' is taking longer than usual."); 19 | break; 20 | case PS.JobState.failed: 21 | case PS.JobState.failedNotBlocking: 22 | case PS.JobState.correlationBlocked: 23 | alert("Failed to update the project. The update job is in state " + job_state); 24 | break; 25 | default: 26 | alert("Unknown error, job is in state " + job_state); 27 | } 28 | }; 29 | 30 | // Initialize the current client context. 31 | var context = PS.ProjectContext.get_current(); 32 | 33 | // Callback for request failure 34 | function OnRequestFailed(sender, args) { 35 | alert("Failed to retrieve project. " + args.get_message()); 36 | }; 37 | 38 | // Retrieves an element id based on name from a collection 39 | function GetIdByName (collection, objectName) { 40 | var collection_enumerator = collection.getEnumerator(); 41 | while (collection_enumerator.moveNext()) { 42 | if (collection_enumerator.get_current().get_name() == objectName) { 43 | return collection_enumerator.get_current().get_id(); 44 | } 45 | } 46 | } 47 | 48 | // Retrieve all projects and lookup the published project by name 49 | var project_list = context.get_projects(); 50 | context.load(project_list, 'Include(Name, Id)'); 51 | context.executeQueryAsync( 52 | function () { 53 | // Load the draft project by name along with tasks, team and assignments 54 | var project_id = GetIdByName(project_list, project_name); 55 | var published_project = project_list.getByGuid(project_id); 56 | var draft_project = published_project.checkOut(); 57 | 58 | var tasks = draft_project.get_tasks(); 59 | var resources = draft_project.get_projectResources(); 60 | var assignments = draft_project.get_assignments(); 61 | 62 | context.load(tasks, 'Include(Id, Name)'); 63 | context.load(resources, 'Include(Id, Name)'); 64 | context.load(assignments, 'Include(Id, Task, Resource)'); 65 | 66 | // Load the project along with tasks, resources and assignments 67 | context.executeQueryAsync( 68 | function () { 69 | var task_id = GetIdByName(tasks, task_name); 70 | var resource_id = GetIdByName(resources, resource_name); 71 | 72 | // No name for assignment, lookup by task/resource 73 | var assignments_enumerator = assignments.getEnumerator(); 74 | while (assignments_enumerator.moveNext()) { 75 | var assignment = assignments_enumerator.get_current(); 76 | if (assignment.get_task().get_id().toString() == task_id.toString() && 77 | assignment.get_resource().get_id().toString() == resource_id.toString()){ 78 | var assignment_id = assignment.get_id(); 79 | } 80 | } 81 | 82 | // Update project description 83 | draft_project.set_description('Changed by CSOM code on ' + (new Date())) 84 | 85 | // Update task duration 86 | var task = tasks.getByGuid(task_id); 87 | task.set_duration('10d'); 88 | 89 | // Update resource standard rate 90 | var resource = resources.getByGuid(resource_id); 91 | resource.set_standardRate(100); 92 | 93 | // Update assignment work percent complete 94 | var assignment = assignments.getByGuid(assignment_id); 95 | assignment.set_percentWorkComplete(50); 96 | 97 | // Send the update request and check in the project 98 | draft_project.update(); 99 | var queue_job = draft_project.checkIn(false); 100 | context.waitForQueueAsync(queue_job, 60, WaitForQueueCallback); 101 | }, 102 | OnRequestFailed 103 | ); 104 | }, 105 | OnRequestFailed 106 | ); 107 | } 108 | -------------------------------------------------------------------------------- /O365-Project-Online-REST-Samples/O365-Project-Online-REST-Samples.sample.yml: -------------------------------------------------------------------------------- 1 | ### YamlMime:Sample 2 | sample: 3 | - name: 'Project add-in: Office 365 Project Online ReST Code Sample' 4 | path: O365-Project-Online-REST-Samples 5 | description: This Project Online ReST code sample demonstrates how to create and update a project using ReST API. 6 | readme: '' 7 | generateZip: FALSE 8 | isLive: TRUE 9 | technologies: 10 | - Office Add-in 11 | azureDeploy: '' 12 | author: NadinMerali 13 | platforms: [] 14 | languages: 15 | - REST API 16 | extensions: 17 | products: 18 | - Project 19 | scenarios: [] 20 | -------------------------------------------------------------------------------- /O365-Project-Online-REST-Samples/README.md: -------------------------------------------------------------------------------- 1 | # Office 365 Project Online ReST Code Sample 2 | 3 | This Project Online ReST code sample demonstrates how to create and update a project using ReST API. 4 | 5 | ## Prerequisites 6 | To use this Project Online ReST code sample, you need the following: 7 | * An Office 365 tenant with a Project license 8 | * The SharePoint client runtime library 9 | * PowerShell v4.0 10 | 11 | ## Modules 12 | * [CreateProject](/createproject.ps1) 13 | * [UpdateProject](/updateproject.ps1) 14 | * [UpdateProjectCustomFields](/updateprojectcustomfieldvalues.ps1) 15 | 16 | ## How the sample affects your tenant data 17 | This sample runs ReST API methods that create, read, update, or delete data. When running commands that delete or edit data, the sample creates sample data. The sample data is created or edited so that your actual tenant data is unaffected. 18 | 19 | ## Questions and comments 20 | 21 | ## Additional resources 22 | * [JavaScript library and REST reference for Project Server 2013](https://msdn.microsoft.com/en-us/library/office/jj712612.aspx) 23 | * [SharePoint and Project Online SDK](https://www.nuget.org/packages/Microsoft.SharePointOnline.CSOM) 24 | 25 | ## Copyright 26 | Copyright (c) 2016 Microsoft. All rights reserved. 27 | -------------------------------------------------------------------------------- /O365-Project-Online-REST-Samples/ReST.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. 3 | See LICENSE in the project root for license information. 4 | #> 5 | 6 | # PS helper methods to call ReST API methods targeting Project Online tenants 7 | $global:fedAuthTicket = '' 8 | $global:digestValue = '' 9 | 10 | function Set-SPOAuthenticationTicket([string] $siteUrl) 11 | { 12 | $username = "admin@contoso.microsoft.com" 13 | Write-Host 'Enter password for user' $username 'on site' $siteUrl 14 | $password = Read-Host -AsSecureString 15 | 16 | # load the SP client runtime code 17 | [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client.Runtime") 18 | $onlineCredentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($username, $password) 19 | if ($onlineCredentials -ne $null) 20 | { 21 | $global:fedAuthTicket = $onlineCredentials.GetAuthenticationCookie($SiteUrl, $true).TrimStart('SPOIDCRL=') 22 | } 23 | 24 | if ([String]::IsNullOrEmpty($global:fedAuthTicket)) 25 | { 26 | throw 'Could not obtain authentication ticket based on provided credentials for specified site' 27 | } 28 | } 29 | 30 | function Build-ReSTRequest([string] $siteUrl, [string]$endpoint, [string]$method, [string]$body = $null) 31 | { 32 | $url = ([string]$siteUrl).TrimEnd("/") + "/_api/" + $endpoint 33 | $req = [System.Net.WebRequest]::Create($url) 34 | $req.Method = $method 35 | 36 | [bool]$isReadOnly = (('GET','HEAD') -contains $req.Method) 37 | [bool]$isDigestRequest = $endpoint -contains 'contextinfo' 38 | 39 | if ([String]::IsNullOrEmpty($body)) 40 | { 41 | $req.ContentLength = 0; 42 | } 43 | else 44 | { 45 | $req.ContentLength = $body.Length 46 | $req.ContentType = "application/json" 47 | } 48 | 49 | $domain = (New-Object System.Uri($url)).Authority 50 | $cookies = New-Object System.Net.CookieContainer 51 | $fedCookie = New-Object System.Net.Cookie 'SPOIDCRL', $global:fedAuthTicket, "", $domain 52 | $cookies.Add($fedCookie) 53 | 54 | $req.CookieContainer = $cookies 55 | 56 | if (-not $isDigestRequest) 57 | { 58 | if (-not $isReadOnly) 59 | { 60 | $req.Headers.Add("X-RequestDigest", $global:digestValue) 61 | } 62 | } 63 | 64 | if (-not [String]::IsNullOrEmpty($body)) 65 | { 66 | $writer = New-Object System.IO.StreamWriter $req.GetRequestStream() 67 | $writer.Write($body) 68 | $writer.Close() 69 | $writer.Dispose() 70 | } 71 | 72 | return $req 73 | } 74 | 75 | function Set-DigestValue([string]$siteUrl) 76 | { 77 | $request = Build-ReSTRequest $siteUrl 'contextinfo' 'POST' $null 78 | if ($request -eq $null) 79 | { 80 | throw 'Could not obtain a request digest value based on provided credentials for specified site' 81 | } 82 | 83 | try 84 | { 85 | $resp = $request.GetResponse() 86 | $reader = [System.Xml.XmlReader]::Create($resp.GetResponseStream()) 87 | if ($reader.ReadToDescendant("d:FormDigestValue")) 88 | { 89 | $global:digestValue = $reader.ReadElementContentAsString() 90 | } 91 | else 92 | { 93 | throw 'Could not obtain a request digest value based on provided credentials for specified site' 94 | } 95 | } 96 | finally 97 | { 98 | if ($reader -ne $null) 99 | { 100 | $reader.Close() 101 | $reader.Dispose() 102 | } 103 | if ($resp -ne $null) 104 | { 105 | $resp.Close() 106 | $resp.Dispose() 107 | } 108 | } 109 | } 110 | 111 | function Post-ReSTRequest([string]$siteUrl, [string]$endpoint, [string]$body = $null) 112 | { 113 | $request = Build-ReSTRequest $siteUrl $endpoint 'POST' $body 114 | $resp = $request.GetResponse() 115 | if ($resp -ne $null) 116 | { 117 | $reader = New-Object System.IO.StreamReader $resp.GetResponseStream() 118 | $reader.ReadToEnd() 119 | $reader.Dispose() 120 | } 121 | } 122 | 123 | function Patch-ReSTRequest([string]$siteUrl, [string]$endpoint, [string]$body) 124 | { 125 | $request = Build-ReSTRequest $siteUrl $endpoint 'PATCH' $body 126 | $resp = $request.GetResponse() 127 | if ($resp -ne $null) 128 | { 129 | $reader = New-Object System.IO.StreamReader $resp.GetResponseStream() 130 | $reader.ReadToEnd() 131 | $reader.Dispose() 132 | } 133 | } 134 | 135 | function Get-ReSTRequest([string]$siteUrl, [string]$endpoint) 136 | { 137 | $request = Build-ReSTRequest $siteUrl $endpoint 'GET' 138 | $resp = $request.GetResponse() 139 | if ($resp -ne $null) 140 | { 141 | $reader = New-Object System.IO.StreamReader $resp.GetResponseStream() 142 | $reader.ReadToEnd() 143 | $reader.Dispose() 144 | } 145 | } 146 | -------------------------------------------------------------------------------- /O365-Project-Online-REST-Samples/createproject.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. 3 | See LICENSE in the project root for license information. 4 | #> 5 | 6 | 7 | # Creates a Project using ReST API 8 | param 9 | ( 10 | # SharepointOnline project site collection URL 11 | $SiteUrl = $(throw "SiteUrl parameter is required") 12 | ) 13 | # Load ReST helper methods 14 | . .\ReST.ps1 15 | 16 | # Set up the request authentication 17 | Set-SPOAuthenticationTicket $siteUrl 18 | Set-DigestValue $siteUrl 19 | 20 | # Project parameters as JSON payload 21 | $projectid = [Guid]::NewGuid() 22 | $body = "{ 23 | 'parameters': { 24 | 'Id': '$projectid', 25 | 'Name': 'Project_$projectid', 26 | 'Description': 'Created from PowerShell using REST API' 27 | } 28 | }" 29 | 30 | # ReST request to create a project 31 | Post-ReSTRequest $SiteUrl "ProjectServer/Projects/Add" $body 32 | 33 | # Wait till new project is finally ready in SharepointOnline. 34 | While ($true) 35 | { 36 | Start-Sleep -Seconds 1 37 | Write-Host "Querying new project's readiness" 38 | $result = Get-ReSTRequest $SiteUrl "ProjectServer/Projects('$projectid')" 39 | if ($result) 40 | { 41 | Write-Host "Project is ready" 42 | break; 43 | } 44 | } 45 | 46 | # ReST request to check out the project 47 | Post-ReSTRequest $SiteUrl "ProjectServer/Projects('$projectid')/checkOut" $null 48 | 49 | # Task parameters as JSON payload 50 | $taskid = [Guid]::NewGuid() 51 | $body = "{ 52 | 'parameters': { 53 | 'Id': '$taskid', 54 | 'Name': 'Task_$taskid', 55 | 'Notes': 'Created from PowerShell using REST API', 56 | 'Start': '2016-01-04T08:00:00', 57 | 'Duration': '5d' 58 | } 59 | }" 60 | 61 | # ReST request to create a task 62 | Post-ReSTRequest $SiteUrl "ProjectServer/Projects('$projectid')/Draft/Tasks/Add" $body 63 | 64 | # Resource parameters as JSON payload 65 | $resourceid = [Guid]::NewGuid() 66 | $body = "{ 67 | 'parameters': { 68 | 'Id': '$resourceid', 69 | 'Name': 'Resource_$resourceid' 70 | } 71 | }" 72 | 73 | # ReST request to create a local resource 74 | Post-ReSTRequest $SiteUrl "ProjectServer/Projects('$projectid')/Draft/ProjectResources/Add" $body 75 | 76 | # Enterprise resource parameters as JSON payload 77 | $enterprise_resourceid = [Guid]::NewGuid() 78 | $body = "{ 79 | 'parameters': { 80 | 'Id': '$enterprise_resourceid', 81 | 'Name': 'EnterpriseResource_$enterprise_resourceid' 82 | } 83 | }" 84 | 85 | # ReST request to create an enterprise resource 86 | Post-ReSTRequest $SiteUrl "ProjectServer/EnterpriseResources/Add" $body 87 | 88 | # ReST request to add an enterprise resource to the project team 89 | Post-ReSTRequest $SiteUrl "ProjectServer/Projects('$projectid')/Draft/ProjectResources/AddEnterpriseResourceById('$enterprise_resourceid')" 90 | 91 | # Assignment parameters as JSON payload 92 | $body = "{ 93 | 'parameters': { 94 | 'ResourceId': '$resourceid', 95 | 'TaskId': '$taskid', 96 | 'Notes': 'Created from PowerShell using REST API' 97 | } 98 | }" 99 | 100 | # ReST request to create an assignment for the local resource 101 | Post-ReSTRequest $SiteUrl "ProjectServer/Projects('$projectid')/Draft/Assignments/Add" $body 102 | 103 | # Assignment parameters as JSON payload 104 | $body = "{ 105 | 'parameters': { 106 | 'ResourceId': '$enterprise_resourceid', 107 | 'TaskId': '$taskid', 108 | 'Notes': 'Created from PowerShell using REST API' 109 | } 110 | }" 111 | 112 | # ReST request to create an assignment for the enterprise resource 113 | Post-ReSTRequest $SiteUrl "ProjectServer/Projects('$projectid')/Draft/Assignments/Add" $body 114 | 115 | # ReST request to publish and check-in the project 116 | Post-ReSTRequest $SiteUrl "ProjectServer/Projects('$projectid')/Draft/publish(true)" $null 117 | -------------------------------------------------------------------------------- /O365-Project-Online-REST-Samples/updateproject.ps1: -------------------------------------------------------------------------------- 1 | # Updates a Project using ReST API 2 | param 3 | ( 4 | # SharepointOnline project site collection URL 5 | $SiteUrl = $(throw "SiteUrl parameter is required"), 6 | $projectId = $(throw "projectId parameter is required"), 7 | $taskId, 8 | $resourceId, 9 | $assignmentId 10 | ) 11 | # Load ReST helper methods 12 | . .\ReST.ps1 13 | 14 | # Set up the request authentication 15 | Set-SPOAuthenticationTicket $siteUrl 16 | Set-DigestValue $siteUrl 17 | 18 | # ReST request to check out the project 19 | Post-ReSTRequest $SiteUrl "ProjectServer/Projects('$projectid')/checkOut" $null 20 | 21 | # ReST request to update the project description 22 | $body = "{'Description':'Updated from PowerShell using REST API'}" 23 | Patch-ReSTRequest $SiteUrl "ProjectServer/Projects('$projectid')/Draft" $body 24 | 25 | # ReST request to update the task duration and start date 26 | if (-not [String]::IsNullOrEmpty($taskId)) 27 | { 28 | $body = "{'Duration':'10d','Start':'2016-01-06T08:00:00'}" 29 | Patch-ReSTRequest $SiteUrl "ProjectServer/Projects('$projectid')/Draft/Tasks('$taskId')" $body 30 | } 31 | 32 | # ReST request to update the resource rate 33 | if (-not [String]::IsNullOrEmpty($resourceId)) 34 | { 35 | $body = "{'StandardRate':'100'}" 36 | Patch-ReSTRequest $SiteUrl "ProjectServer/Projects('$projectid')/Draft/ProjectResources('$resourceId')" $body 37 | } 38 | 39 | # ReST request to update the assignment completion and work 40 | if (-not [String]::IsNullOrEmpty($assignmentId)) 41 | { 42 | $body = "{'PercentWorkComplete':'50','ActualWork':'10h'}" 43 | Patch-ReSTRequest $SiteUrl "ProjectServer/Projects('$projectid')/Draft/Assignments('$assignmentId')" $body 44 | } 45 | 46 | # ReST request to publish and check-in the project 47 | Post-ReSTRequest $SiteUrl "ProjectServer/Projects('$projectid')/Draft/publish(true)" $null 48 | 49 | -------------------------------------------------------------------------------- /O365-Project-Online-REST-Samples/updateprojectcustomfieldvalues.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Project-Samples/7d131365acf017a07534bb69f3ae050dd4e4766e/O365-Project-Online-REST-Samples/updateprojectcustomfieldvalues.ps1 -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | --- 2 | page_type: sample 3 | products: 4 | - office-365 5 | languages: 6 | - csharp 7 | description: "This sample repo includes six samples that show how to build solutions for Project Online." 8 | extensions: 9 | contentType: samples 10 | --- 11 | # Project CSOM Samples 12 | 13 | ## Samples 14 | * [365-Project-Online-OM-ProjToolV2](https://github.com/OfficeDev/O365-Project-Online-.Net-Samples/tree/master/365-Project-Online-OM-ProjToolV2): UI tool that exercises CSOM to perform basic data manipulation on a pwa instance. 15 | * [O365-Project-Online-REST-Samples](https://github.com/OfficeDev/Project-REST-Basic-Operations/tree/master/): Create and update a project using REST API 16 | * [O365-Project-Online-JavaScript-Samples](https://github.com/OfficeDev/O365-Project-Online-.Net-Samples/tree/master/O365-Project-Online-JavaScript-Samples): How to create and update a project using JSOM 17 | * [Copy-Work-Packages](https://github.com/OfficeDev/O365-Project-Online-.Net-Samples/tree/master/Copy-Work-Packages): Copy tasks from one project to another using JSOM 18 | * [Create-Update-Project-Samples](https://github.com/OfficeDev/O365-Project-Online-.Net-Samples/tree/master/Create-Update-Project-Samples) : Create and update a project using CSOM and .Net 19 | * [My-Task-Checklist](https://github.com/OfficeDev/O365-Project-Online-.Net-Samples/tree/master/My-Task-Checklist): Update the status of assignments for the logged in user using C# 20 | 21 | ## Additional resources 22 | 23 | * [PS namespace (ps.js)](https://docs.microsoft.com/previous-versions/office/project-javascript-api/jj669820(v=office.15)) 24 | * [Client-side object model (CSOM) for Project 2013](https://docs.microsoft.com/office/client-developer/project/client-side-object-model-csom-for-project-2013) 25 | * [JavaScript library and REST reference for Project Server 2013](https://docs.microsoft.com/previous-versions/office/project-javascript-api/jj712612(v=office.15)) 26 | * [SharePoint and Project Online SDK](https://www.nuget.org/packages/Microsoft.SharePointOnline.CSOM) 27 | 28 | ## Copyright 29 | Copyright (c) 2016 Microsoft. All rights reserved. 30 | 31 | This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information, see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. 32 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## Security 4 | 5 | Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/). 6 | 7 | If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/opensource/security/definition), please report it to us as described below. 8 | 9 | ## Reporting Security Issues 10 | 11 | **Please do not report security vulnerabilities through public GitHub issues.** 12 | 13 | Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/opensource/security/create-report). 14 | 15 | If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/opensource/security/pgpkey). 16 | 17 | You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://aka.ms/opensource/security/msrc). 18 | 19 | Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue: 20 | 21 | * Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.) 22 | * Full paths of source file(s) related to the manifestation of the issue 23 | * The location of the affected source code (tag/branch/commit or direct URL) 24 | * Any special configuration required to reproduce the issue 25 | * Step-by-step instructions to reproduce the issue 26 | * Proof-of-concept or exploit code (if possible) 27 | * Impact of the issue, including how an attacker might exploit the issue 28 | 29 | This information will help us triage your report more quickly. 30 | 31 | If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/opensource/security/bounty) page for more details about our active programs. 32 | 33 | ## Preferred Languages 34 | 35 | We prefer all communications to be in English. 36 | 37 | ## Policy 38 | 39 | Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/opensource/security/cvd). 40 | 41 | 42 | -------------------------------------------------------------------------------- /SSIS-Package-ODATA-Delta-Sync/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2016 Microsoft Corporation 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /SSIS-Package-ODATA-Delta-Sync/Project_Online_SSIS_Delta_Sync.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/Project-Samples/7d131365acf017a07534bb69f3ae050dd4e4766e/SSIS-Package-ODATA-Delta-Sync/Project_Online_SSIS_Delta_Sync.pdf -------------------------------------------------------------------------------- /SSIS-Package-ODATA-Delta-Sync/SSIS Package for Sync.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.23107.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{159641D6-6404-4A2A-AE62-294DE0FE8301}") = "SSIS Package for Sync", "SSIS Package for Sync\SSIS Package for Sync.dtproj", "{AE020BF8-FB36-4365-B1A4-F2603B0D4D2E}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Development|Default = Development|Default 11 | EndGlobalSection 12 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 13 | {AE020BF8-FB36-4365-B1A4-F2603B0D4D2E}.Development|Default.ActiveCfg = Development 14 | {AE020BF8-FB36-4365-B1A4-F2603B0D4D2E}.Development|Default.Build.0 = Development 15 | EndGlobalSection 16 | GlobalSection(SolutionProperties) = preSolution 17 | HideSolutionNode = FALSE 18 | EndGlobalSection 19 | EndGlobal 20 | -------------------------------------------------------------------------------- /SSIS-Package-ODATA-Delta-Sync/SSIS Package for Sync/OData Source.conmgr: -------------------------------------------------------------------------------- 1 |  2 | 6 | 7 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /SSIS-Package-ODATA-Delta-Sync/SSIS Package for Sync/Project.params: -------------------------------------------------------------------------------- 1 |  2 | -------------------------------------------------------------------------------- /SSIS-Package-ODATA-Delta-Sync/SSIS Package for Sync/SQL Database.conmgr: -------------------------------------------------------------------------------- 1 |  2 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /SSIS-Package-ODATA-Delta-Sync/SSIS Package for Sync/SSIS Package for Sync.database: -------------------------------------------------------------------------------- 1 |  2 | SSIS Package for Sync 3 | SSIS Package for Sync 4 | 0001-01-01T00:00:00Z 5 | 0001-01-01T00:00:00Z 6 | 0001-01-01T00:00:00Z 7 | Unprocessed 8 | 0001-01-01T00:00:00Z 9 | 10 | Default 11 | Unchanged 12 | 13 | --------------------------------------------------------------------------------