If you ever wonder how PowerShell commands operate, what they do when you call them or how you can find out with the following commands what DLL the command is using and you can open the DLL with a disassembler like ILSpy.
· Add a new Table View Controller to your storyboard. From Visual Studio in your toolbox:
· Next drag the app start icon and associate it to the table view controller(This step is not necessary if you do not want the table view controller to be your first view which starts when your app starts.)
· Next create a new class to the table view by pressing on the dark gray area at the bottom of the view and in the Properties window under Identity there is an attribute named Class. Type in there a new class name which will then be automatically created and will appear in your Visual Studio project.
3. Override the GetCell() function to define the cell data for each for being processed. This was defined in the RowsInSection() function. If you had three items in your data source then this function will be called three times. Using the indexPath.Row will get you the row indes which should “normally” correspond to the data source, assuming that the data source can be accessed by an index value.
public override nint NumberOfSections(UITableView tableView)
public override nint RowsInSection(UITableView tableView, nint section)
//return base.RowsInSection(tableView, section);
// Returns a reusable cell, change it values and returns it to be added to the table view
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
var cell = tableView.DequeueReusableCell(“Book”);
var dataInTheCell = this.bookList[indexPath.Row];
cell.TextLabel.Text = dataInTheCell.Name;
//return base.GetCell(tableView, indexPath);
Modifying what is shown in a cell
· First create class for the table view cell. Go to your story board, in the table view controller select the cell in the upper most part, then go to the Properties window => Widget tab => Identity category and Class. In this attribute type the name of the class you want at it will be created.
· Next you modify how the cell looks or what it contains. You can simply add in new controls, give them a text that is shown by default and an identifier in the Identity category of the Properties window in the Widget tab.
· The next steps is to go to the previously defined table cell class and assign values to the controls in the table view cell. In this example there are four different labels which are set through an Book object which is passed to the table view cell.
public BookTableViewCell (IntPtr handle) : base (handle)
· The last step is to go into the code of the table view controller class an modify the GetCell() function code to use the custom table view cell class which you created previously. After this you can access any member function or property etc through code.
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
var cell = tableView.DequeueReusableCell(“Book”) asBookTableViewCell;
· First create a new layout: Go to your Solution Explorer, in your project go to the layout folder and press the second mouse button, then select Add => New Item, then select Android Layout from the new window.
· Next you can add layout elements to position your content and actual content elements like text elements. You could for example add LinearLayuout (Horizontal) and into them text elements (form widgets)
· Remember to set IDs to your UI elements to be able to access them and a text if you want to
Modifying the layout of an UI element
· This can be achieved from the Properties window under the Layout category. Just change the values in that category to modify how it is laid out .
· Generally, to navigate between pages you add new view controller in your storyboard and drag and drop from a UI Element to the desired view control to create a segue.
· After this you select the newly created segue and give it an identifier. You do this by selecting the desired segue and in the Properties window under the Widget tab in the Segue category type in the Identifier attribute
· To transition from using the right segue in the code you can do the following:
· This is rather simple, “normal” C# and Visual Studio stuff. the simplest approach is to create a class library, then create code in it which you want to use in your destination project. Once you are done with your shared class library simply Reference it in Visual Studio and make sure that you are using the right namespaces to access the classes or other code functionality defined in the shared projects.
· Notice: It has to be a portable class library. Otherwise you will not be able to use 3rd party libraries with your application.
· Next you choose your target platform which you want to use with your shared code.
· You could also use some predefined Xamarin project templates with this if you want.
· Scaling your application UI to work on different resolutions on different iOS devices
· A quick way to add constraints is to add it from the main.storyboard upper right corner after you have selected an UI control/element
· To specify manually constraints click once then another time on a UI element so that it looks something like this. Pay attention to the new options to specify constraints for the UI element, these are the T shaped icons near the edges of the element.
· To add a new constraint drag a T shaped icon to another element or the edge of the screen telling how the element should behave, how much space for example to leave between this element and another or the screen edge.
If you want to change the LastModified and Created fields of a list item or a document you can use this code to do that:
using (SPSite site = new SPSite("site + web url"))
using (SPWeb web = site.OpenWeb())
web.AllowUnsafeUpdates = true;
SPListItem listItem = web.GetListItem(this.tbItemURL.Text);
if (this.cCreatedDate.SelectedDate != new DateTime())
listItem[SPBuiltInFieldId.Created] = this.cCreatedDate.SelectedDate;
listItem[SPBuiltInFieldId.Created] = listItem[SPBuiltInFieldId.Created];
if (this.cModifiedDate.SelectedDate != new DateTime())
listItem[SPBuiltInFieldId.Modified] = this.cModifiedDate.SelectedDate;
listItem[SPBuiltInFieldId.Modified] = listItem[SPBuiltInFieldId.Modified];
if (listItem.ModerationInformation != null)
web.AllowUnsafeUpdates = false;
The reason why the above is done is because if you simply change the date values and use the UpdateOverwireVersion() it will not be enough. The search will not be able to index right values EVEN if you check the UI or use PowerShell or SharePoint Manager etc. All of those show that the value is OK but actually is not. The manually inserted dates will not show up in search unless the item or document is published and approved. So no matter that SP says remember this :).
another thing is that this code above does not allow to set a LastModified IF you have publishing/versioning enabled. After calling the UpdateOverwriteVersion function the item or document will be checked out and remains in that state until something is done. Once you do that you are back to where you started the modified date is changed automatically by SP.
Target i0S, Android, Windows and Mac with a single, shared C# codebase. Use the same language, APIs and data structures on every platform.
C# is the best language for mobile app development
Anything you can do on Objective-C, Swift or Java, you can do in C#
Native UI, native API access, native performance
Xamarin apps are built with standard, native user interface controls. Apps not only look the way the end user expects, they behave that way too. This can’t be achieved with other solutions. They look and behave as they would on that native environment (Android. iOS, Windows Phone)
· In an Android application you have to find the controls manually and assign them to a variable of the same type.
· You use the FindViewById<>() function call. You pass the class type to the template(generic) parameter, then pass the control ID by accessing your project namespace then Resources class, then Id class and finally the control ID which you define in your layout.
· In the activity from where you want a value to be passed to another activity you use the Intent class member function named PutExtra() to store the value. It is a key value pair which can be retrieved in another activity later:
var intent = new Intent(this, typeof(BMIDetailsActivity));
· And to restore the value you access it through the activity Intent class member by accessing from it the Extras member. From there use the GetFloat() function.
· Next create a relationship between the navigation controller and the main view by pressing CTRL + left mouse button on the navigation controller and dragging the mouse over the main view. Then you select the Root option from the new popup. This will mark the main view as the root view.
· Next drag a new view on the storyboard and give it a name. Once you do this the developer tool will warn you that there is no code behind class associated with the view(In Xamarin Studio the UI will offers you to create one). In Visual Studio the easiest way to do it is to press the dark grey area on the view without a controller and writing a new class name in the Class property in the properties window. This will create a new view controller associated to the view selected.
· To navigate from your Main(root) view just select a control that can be pressed like a button, press CTRL + left mouse button on it, then drag to the desired view and let go of the mouse button. In the new popup select Show. This is it. A connection and transition has been made between the views.
· To pass a value between views/segues you can override the function PrepareForSegue() which is launched when the segue is about to be used, that is when the user presses a button or some other UI element which invokes the action of moving from one view/page/layout to another one. What was done earlier.
· In the function you then access the parameter segue and ask for the DestinationViewController class member which you have to cast to the target view controller class. After that it is simply of matter of accessing the defined properties in the view controller class. Same as accessing any public member of a class.
public override void PrepareForSegue(UIStoryboardSegue segue, NSObject sender)
var detailViewController = segue.DestinationViewController asBMIDetailsViewController2;
Ok, this is one way of doing this. Perhaps this is useful in a situation where you need to backup lists with their data from an older SharePoint version and restore it in another SharePoint version. Preferably doing this quickly without worrying about site templates or something more than the list and its data.
The script below gets lists in a target web location, saves them as list templates and download them in the hard drive.
Approach 1: Export the list through Export-SPWeb and restore with Import-SPWeb
SharePoint List must meet the following criteria to move a list by using a list template (source):
The list must contain less than 10 megabytes (MB) of list data.
You must be a member of a site group with the Manage Lists right on the source site and on the destination site. By default, the Manage Lists right is included in the Web Designer and Administrator site groups.
The source site and the destination site must be based on the same site template.
Next from the Azure navigation go to your active directory. Next you should see different options in the top area of the your AAD, such as:
Users, Groups, Applications, Domain and so on.
Select the Applications section.
Next you should get a listing of applications configured in your AAD.
Next from the AAD UI select ADD to add a new application.
Select what type of an application it is. You can use both option. I used the configurations of an MVC application which allowed me to work just fine. What matters is the client ID, client secret key and the privileges. The redirect URL is not necessary for a Native Application, you can type in anything as long as it is a URL.
After your application is created go to the configure section.
Here find the client ID and copy store it somewhere to be used later.
Then go to the keys section and add a new key(client secret)
Then scroll down and go the applications section and add the Microsoft Graph application and select the needed privileges. In this case, you would like at least to be able to read groups.
That is it, next is some code.
Request a token for your application
This is the piece of code that will get the token from your application. The constants and parameters will be explained soon.
If you have been playing around with the Site Provisioning in the PnP Partner Pack you might have run into problems when installing it. While the instructions are rather good there are still some problems which I ran into and are not mentioned in the instruction(or I might have just passed by them).
Notice that the things mentioned here assumes that you have read or understand how to install the site provisioning web app by this instruction:
When you are defining your Sign-On URL in the Configure section for your application, there is a very weird and annoying error that the site provisioning web application might throw. This is due that you are missing one single character from the end of your URL which is: /
URL which does not work: https://pnpprovisioning82.azurewebsites.net
URL which does work: https://pnpprovisioning82.azurewebsites.net/
Do you see the difference :)? Small but enough to make you wonder. The error message is not necessarily very informative and unfortunately I do not have that error message anymore, can paste it here. Just check this thing in case of errors.
The web jobs are good and working BUT the installation is a bit misleading. I had to figure out for myself and gather the info from different locations. My problem was that the script which was supposed to install the jobs automatically did not work. Some error which did no make sense and I did not want to spend time figuring out. If it works for you then that is great. If not you might have to do this manually.
You have different way on how to do this manually:
Through Azure portal management
Through visual studio
Azure portal management
Build a release version of the webjob
Just zip the entire release folder and rename your zip package
Go to your web application web jobs section
Click add a new job and upload your ZIP file and define how you want your job to run
On the web job project which you want to upload to Azure press the second button and chose “Publish as Azure Webjob” and follow the instructions.
You might want to take advantage of the Azure management UI by downloading a publishing profile from your web application dashboard. You can use this publishing profile in Visual Studio.
The webjobs what they do
This is the one which will be reading the PnPProvisioningJobs list and create jobs to be processed by the other webjobs. You have to have this on to get anything done, mostly related to site provisioning. I might be wrong on some of the details here but having this on is essential.
My understanding is that his job is what is provisioning the sites and creating templates of sites.
Guide – What is where or how things work
The web application overall UI functionality
As is mentioned in this documentation there are several views(pages) which are used with the site provisioning. Notice that not all of them are available through the web application UI and this in my opinion is confusing.
Some of the functionalities are only available in a actual site:
Creating a new sub site
This is only available when you go to a site, from “site settings” select “site contents”. The PnP Partner Pack overrides the default “New subsite” link. I kind of understand this but was not the first place where I expected it to be.
Saving a site template
This can be found under your site “site settings” in the category “site actions”. There is a JS file which is attached to your PnP sites which add a new link here named as “Save site as Provisioning Template”.
The JS file is located in the infrastructure site in the Library: PnPProvisioningTemplates under the folder: Overrides. Through the XML file in this location the JS file is loaded and the two above mentioned things are performed.