European Sharepoint 2013 Hosting Blog
Articles about European Sharepoint Hosting Service
Articles about European Sharepoint Hosting Service
Aug 6th
1 |
Install-Module SharePointPnPPowerShellOnline |
1 |
connect-PnPOnline –Url https://fortunestrikes.sharepoint.com –Credentials (Get-Credential) |
Syntax – https://docs.microsoft.com/en-us/powershell/module/sharepoint-pnp/remove-pnplist?view=sharepoint-ps
1 2 3 4 5 6 |
Remove-PnPList -Identity <ListPipeBind> [-Recycle [<SwitchParameter>]] [-Force [<SwitchParameter>]] [-Web <WebPipeBind>] [-Connection <PnPConnection>] |
Syntax – Remove List item
1 2 3 4 5 6 7 |
Remove-PnPListItem -List <ListPipeBind> -Identity <ListItemPipeBind> [-Recycle [<SwitchParameter>]] [-Force [<SwitchParameter>]] [-Web <WebPipeBind>] [-Connection <PnPConnection>] |
1 |
Remove-PnPList -Identity DemoList |
1 |
Remove-PnPListItem -List "Demo List" -Identity "5" -Force |
Jul 23rd
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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Microsoft.SharePoint.Client; using System.Security; namespace RestoreRecyclebinSharepointItem { class Program { static void Main(string[] args) { SecureString pwd = new SecureString(); string Username ="testusera@demo.onmicrosoft.com"; string password = "Password"; try { using (ClientContext ctx = new ClientContext("https://portal.sharepoint.com/sites/Demosite")) { foreach (char c in password.ToArray()) pwd.AppendChar(c); ctx.Credentials = new SharePointOnlineCredentials(Username, pwd); RecycleBinItemCollection recycleBinItems = ctx.Site.RecycleBin; ctx.Load(recycleBinItems); ctx.ExecuteQuery(); //Restore all items from Recycle Bin recycleBinItems.RestoreAll(); ctx.ExecuteQuery(); Console.WriteLine("item restored"); } } catch (Exception ex) { } Console.ReadLine(); } } } |
Jul 16th
Now, I will tell you about how to Resolving The “Out Of Date Nintex Forms” Error In SharePoint Online. While working with Nintex Form for Office 365, you may get this error. Thus, let’s learn all the possible solutions for this error. I have customized my SharePoint Online custom list add Form, using Nintex Forms for Office 365. It worked perfectly. Subsequently, I thought of adding some validations, using JavaScript code. Hence, I followed the steps given below.
– Click on Form Setting on Nintex Form designer screen.
– Under Custom JavaScript option, I simply wrote alert (‘Hello’).
– Subsequently, I published the form.
– Now, when I try to add a new item in my custom list, it opens Nintex Form and I get the error given below.
Once I clicked on OK, the list form closed and default list view was displayed.
Hence, I thought that maybe my Nintex Form for Office 365 app was outdated. I searched how to update Nintex Forms for Office 365 app. I found so many links but I found that my Nintex Form is up to date.
Thus, it gave me trouble. I kept on searching. Finally, I found the solution. When I found the solution, I was really disappointed with Nintex Forms error message, as it is misleading.
The problem was with my JavaScript code and not with the app.
What did I do wrong? I wrote the wrong syntax.
1 |
alert('Hello') |
Instead, write the code given below.
1 |
alert('Hello'); |
The only mistake was I missed the semicolon (;) and I got this error message. I corrected the code and everything was fine and I got an alert message with “Hello”.
Thus, I thought of sharing this, because the error message is somehow misleading in finding the solution.
Thus, when you get the error like this, then do the checks given below.
If you have injected any kind of JavaScript code to Nintex Forms, then please make sure that the code has proper syntax.
If you don’t have any JavaScript code, go for updating Nintex Forms for Office 365 app.
It saved my time to a phenomenal extent. I hope, this will save time for others also.
If you have any query regarding this or you need more information, please feel free to ask in the comment section.
HostForLIFE.eu’s SharePoint 2016 Hosting solution offers a comprehensive feature set that is easy-to-use for new users, yet powerful enough for the most demanding web developer expert. Hosted SharePoint Foundation 2016 is the premiere web-based collaboration and productivity enhancement tool on the market today. With SharePoint 2016 Foundation, you can quickly access and manage documents and information anytime, anywhere though a Web browser in a secure and user friendly way. SharePoint hosting services start at only at €9.99/mo, allowing you to take advantage of the robust feature set for a small business price. HostForLIFE.eu offers a variety of hosted SharePoint Foundation 2016 plans as well as dedicated SharePoint 2016 Foundation options.
Jul 3rd
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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
using System; using System.Security; using Microsoft.SharePoint.Client; namespace ConsoleApp7 { class Program { /// <summary> /// This is the main entry function /// </summary> /// <param name="args"></param> static void Main(string [] args) { #region [Variables] string schemaTextField = string.Empty; string password = string.Empty; #endregion #region [SP Variables] ClientContext ctx = null; Web spWeb = null; List spList = null; SecureString securStr = null; ListItemCreationInformation spItemInfo = null; ListItem spItem = null; Field simpleTextField=null; #endregion using (ctx = new ClientContext("https://contoso.sharepoint.com/sites/sitename")) { try { securStr = new SecureString(); password = "Enter the password"; foreach (char ch in password) { securStr.AppendChar(ch); } ctx.Credentials = new SharePointOnlineCredentials("Enter UserName", securStr); spWeb = ctx.Web; ctx.Load(spWeb); spList = spWeb.Lists.GetByTitle("listName"); schemaTextField = "Field Type='Text' Name='MyCustomTextField' StaticName='MyCustomTextField' DisplayName='MyCustomTextField' />"; simpleTextField = spList.Fields.AddFieldAsXml(schemaTextField, true, AddFieldOptions.AddFieldInternalNameHint); ctx.ExecuteQuery(); for (var i = 1; i < 20; i++) { try { spItemInfo = new ListItemCreationInformation(); spItem = spList.AddItem(spItemInfo); spItem["Title"] = "MyNewItem-" + i.ToString(); spItem["MyCustomTextField"] = "My Custom Values-" + i.ToString(); spItem.Updzcate(); } catch (Exception ex) Console.WriteLine("Error:- " + ex.ToString()); } } ctx.ExecuteQuery(); } catch (Exception ex) { Console.WriteLine("Error:- " + ex.ToString()); } } } } } |
Jun 26th
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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 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 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
using System; using System.Security; using Microsoft.SharePoint.Client; namespace Createcontenttype { class Program { static void Main(string[] args) { #region[Variables] string username = string.Empty; string password = string.Empty; #endregion #region[SP Variables] Web spWeb = null; ContentType contentType = null; #endregion using(ClientContext context = new ClientContext(https: //sharepoint.com/site)) //Enter the site url { SecureString securstr = new SecureString(); password = "1234@abc"; //Enter the password foreach(char ch in password) { securstr.AppendChar(ch); } context.Credentials = new SharePointOnlineCredentials("user.onmicrosoft.com", securstr); //Enter the user id spWeb = context.Site.RootWeb; context.Load(spWeb); context.Load(context.Web); contentType = CreateSpContentType(context, spWeb, contentType); CreateSiteField(context, spWeb, contentType); AddContentType(context, spWeb); Console.WriteLine("Success"); Console.ReadLine(); } } private static ContentType CreateSpContentType(ClientContext context, Web spWeb, ContentType contentType) { try { contentType = spWeb.ContentTypes.Add(new ContentTypeCreationInformation { Name = "Employee Info", Id = "0x0100A33D9AD9805788419BDAAC2CCB37509E", Group = "List Content Types" }); context.ExecuteQuery(); } catch (Exception e) { Console.WriteLine(e.Message); } return contentType; } private static void CreateSiteField(ClientContext context, Web spWeb, ContentType contentType) { #region[Variables] string[] trgtfld = { "EmployeeName", "EmpAddress", "EmpCity", "JoinDate", "EmpGender" }; FieldCollection fields = null; FieldLinkCreationInformation fldLink = null; Field txtFld = null; string TxtFieldAsXML = string.Empty; Field addFld = null; string addFieldAsXML = string.Empty; string cityFieldAsXML = string.Empty; Field cityFld = null; string jdFieldAsXML = string.Empty; Field jdFld = null; string genFieldAsXML = string.Empty; Field genFld = null; #endregion try { fields = spWeb.Fields; context.Load(fields); //Adding site column to site TxtFieldAsXML = @ "<Field Name='EmployeeName' DisplayName='Employee Name' Type='Text' Hidden='False' Group='EmployeeData' />"; txtFld = fields.AddFieldAsXml(TxtFieldAsXML, true, AddFieldOptions.DefaultValue); addFieldAsXML = @ "<Field Name='EmpAddress' DisplayName='EmpAddress' Type='Note' Hidden='False' Group='EmployeeData' />"; addFld = fields.AddFieldAsXml(addFieldAsXML, true, AddFieldOptions.DefaultValue); cityFieldAsXML = @ "<Field Name='EmpCity' DisplayName='EmpCity' Type='Text' Hidden='False' Group='EmployeeData' />"; cityFld = fields.AddFieldAsXml(cityFieldAsXML, true, AddFieldOptions.DefaultValue); jdFieldAsXML = @ "<Field Name='JoinDate' DisplayName='JoinDate' Type='DateTime' Hidden='False' Group='EmployeeData' />"; jdFld = fields.AddFieldAsXml(jdFieldAsXML, true, AddFieldOptions.DefaultValue); genFieldAsXML = @ "<Field Name='EmpGender' DisplayName='EmpGender' Type='Choice' Hidden='False' Group='EmployeeData' Format='Dropdown'>" + "<CHOICES>" + "<CHOICE>Male</CHOICE>" + "<CHOICE>Female</CHOICE>" + "</CHOICES>" + "</Field>"; genFld = fields.AddFieldAsXml(genFieldAsXML, true, AddFieldOptions.DefaultValue); context.Load(fields); foreach(var fld in trgtfld) { try { contentType = spWeb.ContentTypes.GetById("0x0100A33D9AD9805788419BDAAC2CCB37509E"); fldLink = new FieldLinkCreationInformation(); fldLink.Field = context.Web.AvailableFields.GetByInternalNameOrTitle(fld); contentType.FieldLinks.Add(fldLink); contentType.Update(false); } catch (Exception e) { Console.WriteLine(e); } context.ExecuteQuery(); } } catch (Exception e) { Console.WriteLine(e); } } private static void AddContentType(ClientContext context, Web spWeb) { #region[Variables] ListCollection spListColl = null; ContentType spContentType = null; #endregion try { spListColl = spWeb.Lists; context.Load(spListColl); context.ExecuteQuery(); foreach(List list in spListColl) { try { if (list.BaseTemplate == 100) { list.ContentTypesEnabled = true; spContentType = spWeb.ContentTypes.GetById("0x0100A33D9AD9805788419BDAAC2CCB37509E"); list.ContentTypes.AddExistingContentType(spContentType); list.Update(); spWeb.Update(); context.ExecuteQuery(); } } catch (Exception e) { Console.WriteLine(e); } } } catch (Exception e) { Console.WriteLine(e); } } } } |
Jun 19th
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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 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 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
using System; using System.Security; using Microsoft.SharePoint.Client; namespace Createcontenttype { class Program { static void Main(string[] args) { #region[Variables] string username = string.Empty; string password = string.Empty; #endregion #region[SP Variables] Web spWeb = null; ContentType contentType = null; #endregion using(ClientContext context = new ClientContext(https: //sharepoint.com/site)) //Enter the site url { SecureString securstr = new SecureString(); password = "1234@abc"; //Enter the password foreach(char ch in password) { securstr.AppendChar(ch); } context.Credentials = new SharePointOnlineCredentials("user.onmicrosoft.com", securstr); //Enter the user id spWeb = context.Site.RootWeb; context.Load(spWeb); context.Load(context.Web); contentType = CreateSpContentType(context, spWeb, contentType); CreateSiteField(context, spWeb, contentType); AddContentType(context, spWeb); Console.WriteLine("Success"); Console.ReadLine(); } } private static ContentType CreateSpContentType(ClientContext context, Web spWeb, ContentType contentType) { try { contentType = spWeb.ContentTypes.Add(new ContentTypeCreationInformation { Name = "Employee Info", Id = "0x0100A33D9AD9805788419BDAAC2CCB37509E", Group = "List Content Types" }); context.ExecuteQuery(); } catch (Exception e) { Console.WriteLine(e.Message); } return contentType; } private static void CreateSiteField(ClientContext context, Web spWeb, ContentType contentType) { #region[Variables] string[] trgtfld = { "EmployeeName", "EmpAddress", "EmpCity", "JoinDate", "EmpGender" }; FieldCollection fields = null; FieldLinkCreationInformation fldLink = null; Field txtFld = null; string TxtFieldAsXML = string.Empty; Field addFld = null; string addFieldAsXML = string.Empty; string cityFieldAsXML = string.Empty; Field cityFld = null; string jdFieldAsXML = string.Empty; Field jdFld = null; string genFieldAsXML = string.Empty; Field genFld = null; #endregion try { fields = spWeb.Fields; context.Load(fields); //Adding site column to site TxtFieldAsXML = @ "<Field Name='EmployeeName' DisplayName='Employee Name' Type='Text' Hidden='False' Group='EmployeeData' />"; txtFld = fields.AddFieldAsXml(TxtFieldAsXML, true, AddFieldOptions.DefaultValue); addFieldAsXML = @ "<Field Name='EmpAddress' DisplayName='EmpAddress' Type='Note' Hidden='False' Group='EmployeeData' />"; addFld = fields.AddFieldAsXml(addFieldAsXML, true, AddFieldOptions.DefaultValue); cityFieldAsXML = @ "<Field Name='EmpCity' DisplayName='EmpCity' Type='Text' Hidden='False' Group='EmployeeData' />"; cityFld = fields.AddFieldAsXml(cityFieldAsXML, true, AddFieldOptions.DefaultValue); jdFieldAsXML = @ "<Field Name='JoinDate' DisplayName='JoinDate' Type='DateTime' Hidden='False' Group='EmployeeData' />"; jdFld = fields.AddFieldAsXml(jdFieldAsXML, true, AddFieldOptions.DefaultValue); genFieldAsXML = @ "<Field Name='EmpGender' DisplayName='EmpGender' Type='Choice' Hidden='False' Group='EmployeeData' Format='Dropdown'>" + "<CHOICES>" + "<CHOICE>Male</CHOICE>" + "<CHOICE>Female</CHOICE>" + "</CHOICES>" + "</Field>"; genFld = fields.AddFieldAsXml(genFieldAsXML, true, AddFieldOptions.DefaultValue); context.Load(fields); foreach(var fld in trgtfld) { try { contentType = spWeb.ContentTypes.GetById("0x0100A33D9AD9805788419BDAAC2CCB37509E"); fldLink = new FieldLinkCreationInformation(); fldLink.Field = context.Web.AvailableFields.GetByInternalNameOrTitle(fld); contentType.FieldLinks.Add(fldLink); contentType.Update(false); } catch (Exception e) { Console.WriteLine(e); } context.ExecuteQuery(); } } catch (Exception e) { Console.WriteLine(e); } } private static void AddContentType(ClientContext context, Web spWeb) { #region[Variables] ListCollection spListColl = null; ContentType spContentType = null; #endregion try { spListColl = spWeb.Lists; context.Load(spListColl); context.ExecuteQuery(); foreach(List list in spListColl) { try { if (list.BaseTemplate == 100) { list.ContentTypesEnabled = true; spContentType = spWeb.ContentTypes.GetById("0x0100A33D9AD9805788419BDAAC2CCB37509E"); list.ContentTypes.AddExistingContentType(spContentType); list.Update(); spWeb.Update(); context.ExecuteQuery(); } } catch (Exception e) { Console.WriteLine(e); } } } catch (Exception e) { Console.WriteLine(e); } } } } |