Click or drag to resize

ShareFactoryCreateDefaults Method (IContext, String, Int32, IUser, NullableInt32, NullableGuid)

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: AskiaPortalCmnIContext
Execution context
objectType
Type: SystemString
Type of the shared object
objectId
Type: SystemInt32
Id of the shared object
user
Type: AskiaPortalCmnIUser
The user
surveyId (Optional)
Type: SystemNullableInt32
Id of the survey
moduleGuid (Optional)
Type: SystemNullableGuid
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