Click or drag to resize

ShareFactory.CreateDefaults Method (IContext, String, Int32, IUser, Nullable<Int32>, Nullable<Guid>)

Creates default sharing

Namespace:  AskiaPortalCmn
Assembly:  AskiaPortalCmn (in AskiaPortalCmn.dll) Version: 1.7.0-build068
Syntax
public static IReturnValue CreateDefaults(
	IContext context,
	string objectType,
	int objectId,
	IUser user,
	Nullable<int> surveyId = null,
	Nullable<Guid> moduleGuid = null
)

Parameters

context
Type: AskiaPortalCmn.IContext
Execution context
objectType
Type: System.String
Type of the shared object
objectId
Type: System.Int32
Id of the shared object
user
Type: AskiaPortalCmn.IUser
The user
surveyId (Optional)
Type: System.Nullable<Int32>
Id of the survey
moduleGuid (Optional)
Type: System.Nullable<Guid>
GUID of the module

Return Value

Type: IReturnValue
Returns success result when the process was successfully done.
Examples

Share the AskiaPortal survey by default

if (Convert.ToBoolean(context.User.Settings[SettingsKey.ShareByDefault].Value))
{
    var result = ShareFactory.CreateDefaults(context, ShareObjectType.Survey, 12, context.User);
    if (!result.Success)
    {
        Console.Error.WriteLine(result.Exception);
    }
}
See Also